我有一个 html 页面保存在我的捆包中, i 在 html 中有一些标签, 如 { PRICE} 等, 这些标签会被代码在运行时的实际值替换 。
str=[str stringByReplacingOccurrencesOfString:@"{PRICE}" withString:[self currencyForKey:@"my price"]];
i 已经确保了不以这种货币保值法返回任何无效值,但在创建整个 html 页面之后,通过以这些值替换所有标签, 并在网页视图中显示某些特殊的流浪字符, 这些特殊字符包含在最后的网页中。
   
我检查了整个初始 html 页面和我的整个工程, 查找了这些字符, 但找不到这些字符 。?? 我正使用 nsasciistring 编码从 html 中创建在捆绑中保存的字符串 。
NSString *path=[[NSBundle mainBundle] pathForResource:@"myhtml" ofType:@"html"];
NSData *htmlData=[NSData dataWithContentsOfFile:path];
NSString *tableStr=[[NSString alloc] initWithData:htmlData encoding:(NSStringEncoding)NSASCIIStringEncoding];