objective c - How to detect characters with unknown encoding (like Textmate)? -
textmate not allow open file characters in unknown encoding. example, when wrong encoding selected, open button disabled:

when proper encoding selected, open button enabled:

is there c or objective-c library reporting characters encoded outside current encoding?
the usual approach load text assuming default encoding (like utf-8/16 or latin 1). if there's bom @ start of text indication text form of unicode. bom helps find transformation format used (utf-8 etc.).
if loading text still fails it's time ask user hint (charset selection), because it's difficult guess used encoding is.
Comments
Post a Comment