My NSDocument subclass overrides 
fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error: 
and returns:
    CharacterEncoding = 2147484701; ← Thai (Windows, DOS) 
    DocumentType = NSPlainText;
    UTI = "public.plain-text";

When I open the file again I get in readFromURL:ofType:error:
    CharacterEncoding = 30; ← Western (Mac OS Roman)
    DocumentType = NSPlainText;
    UTI = "public.plain-text";
And of course, it looks like complete rubbish.

There are no extendedAttributes to be seen (xattr -l reports nothing).

When I open the file in TextEdit (specifying Thai (Windows, DOS) in the 
OpenPanel) I get readable stuff. 
And when I save the file with TextEdit there is an extended attribute: 
com.apple.TextEncoding = cp874;1053.

Opening the file again with my app I get the correct encoding and everything 
looks fine.

How is this supposed to work?
What am I missing? Do I have to set the extended attribute myself?

TextEdit seems to override fileWrapperOfType:error: - is this the only way to 
get the extended attribute written?
What is the point of  
fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:  
if the dictionary returned is simply ignored?

Gerriet.



_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to