它包含二进制数据之间的元数据。我能够用标题Agent_of_Chang2e解析第一行,但我也需要在标题底部获取元数据。我知道这方面没有标准的细节。

这段代码无法解码底线。例如,我得到了以下格式错误的文本:
FÃHANGETIa÷orkyfiction.Áll@eãacÐ0hðortrayedén{n)áreïrzus0¢°usly.Ôhatíean0authhmxétlõp.7N_\ (C)( 1988âyÓOOKãsòeserved.0ðart)publicaZmayâehproduc )
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
char buffer[1024];
FILE* file = fopen([path UTF8String], "r");
if (file != 0)
{
while(fgets(buffer, 1024, file) != NULL)
{
NSString* string = [[NSString alloc] initWithCString: buffer encoding:NSASCIIStringEncoding];
NSLog(@"%@",string);
[string release];
}
fclose(file);
}
[pool drain];发布于 2014-04-04 15:00:24
首先,我很确定文本将是UTF-8或UTF-16编码.
第二,您不能只是随机抽取1024字节,并期望它们作为文本工作。字节顺序如何(大端对小端)?
https://stackoverflow.com/questions/22713027
复制相似问题