Xcode 4 default text encoding

How do I set the Xcode 4 default text encoding?

I've tried to set it in Preferences > Text Editing > Default text encoding, but it takes no effect over my workspace and all my files.

When I open the File Inspector, the default text encoding is always set to Western (Mac OS Roman) regardless of configured preference.

Thanks in advice!

Posted on Jul 14, 2011 10:12 AM

Reply
5 replies

Jul 14, 2011 10:53 AM in response to Felsangom

Apple seems to be getting clever in their old age. Check one or more of your files with xattr. The file system seems to be keeping track of the text encoding, even for whiles whose content is just ASCII. When I change the encoding of files that need UTF-8, or that don't, they all show up properly in Xcode. Are you using a networked filesystem perhaps? If so, you might not get that new metadata lovin'.

Jul 14, 2011 12:03 PM in response to etresoft

I've used the xattr on some files, but there is no extra properties defined.


Seems that Xcode need the BOM (byte order mark) to be present at the beginning of the file so the encoding gets detected successfully.

I've tried to add the sequence \xEF\xBB\xBF to the beginning of some files, and Xcode detects UTF-8 and the content is shown properly.


The problem now is that I have lots of files on my project, and add the BOM to the beginning of each file is inviable.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Xcode 4 default text encoding

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.