I'm working on a feature that will see my program automatically export to a UTF-8 text file. This process works fine. What doesn't work fine is that TextEdit.app (and others) does not recognise it automatically as a UTF-8 text file, even when "Plain Text Encoding: Opening Files:" (in Preferences) is set to "Automatic".
Question: Is there any header I can put at the beginning of the text file to get it automatically recognised as UTF-8? Here is some background, and what I'm trying to do: T.txt - a UTF-8 file: 1. When opened in TextEdit, UTF-8 is not detected. 2. When opened in Pages, UTF-8 is not detected. 3. When opened in TextMate, UTF-8 is detected. 4. When opened in MacVim, UTF-8 is detected. If I rename T.txt to T.utf8: 1. When opened in TextEdit, UTF-8 is detected. 2. When opened in Pages, file is not loaded. 3. When opened in TextMate, UTF-8 is detected. 4. When opened in MacVim, UTF-8 is detected. What I need is for TextEdit to open it properly, with the .txt extension (I include the rest just for comparison). I can get TextEdit to do this if I set "Plain Text Encoding: Opening Files:" to "UTF-8". But I'd rather not have my users make this change if not absolutely necessary (it screams support issues). I've tried prefacing the text file with a BOM in this way: [textStream appendFormat:@"%C%C%C",0x00EF,0x00BB,0x00BF]; // textStream is an empty NSMutableString that gets added to, and then written to a file Is there any way to do what I'm trying to do? Thanks._______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com