问题:
iOS用GDataXML保存中文到XML文件会出现&#x开头的字符,不是直观的汉字。
解决办法:
修改 GDataXMLNode.m里面的
- (NSData *)XMLData {
if (xmlDoc_ != NULL) {
xmlChar *buffer = NULL;
int bufferSize = 0;
//Howard 2018-09-13 修改如下,把下面一句改掉
//xmlDocDumpMemory(xmlDoc_, &buffer, &bufferSize);
xmlDocDumpMemoryEnc(xmlDoc_, &buffer, &bufferSize, "utf-8");
if (buffer) {
NSData *data = [NSData dataWithBytes:buffer
length:bufferSize];
xmlFree(buffer);
return data;
}
}
return nil;
}