在我的iOS开发中,我应该使用什么编码来编码温度符号?

时间:2012-12-16 03:17:54

标签: ios encode temperature

char symbol[] = {0xa1,0xe3};  //temperatue symbol code

NSString *degree = [NSString stringWithCString:symbol encoding:NSASCIIStringEncoding];

//when "degree" displayed on screen,messy code.

我应该使用哪种编码?似乎NSASCIIStringEncoding不起作用。

或任何其他方法可以帮助解决它?

1 个答案:

答案 0 :(得分:2)

为什么要解决所有这些麻烦?只需直接在代码中输入度数符号吗?

NSString *temp = [NSString stringWithFormat:@"%d °C", someVal]; // Char U+00B0

更好的是Unicode U+2103)或U+2109)。