Support more encodings in TextEdit
Feb 26, '02 02:09:34AM
Contributed by: kent37
This tip expands on a note I read in the cocoa-dev mailing list.
As it ships, TextEdit can open files in nine encodings, including Unicode, UTF-8 and Shift-JIS. This is pretty handy, but there's more - it is fairly easy to change the list of supported encodings to include any of the over 100 built in to Cocoa.
Here is how you do it:
- In the Finder, control-click on the TextEdit application and select Show Package Contents. This opens a new window with a Contents folder.
- Open Contents/Resources
- Make a copy of the file MoreEncodings.plist; call the copy Encodings.plist
Now if you launch TextEdit, you will have 33 encodings to choose from. These encodings are specified in Encodings.plist.
To continue with this tip, you will need the developer tools. Assuming you have them, do this:- Open Encodings.plist in PropertyListEditor or a text editor.
- Open the file /System -> Library -> Frameworks -> CoreFoundation.framework -> Versions -> A -> Headers -> CFStringEncodingExt.h in a text editor. This file lists all the encodings supported in Cocoa. By adding entries to Encodings.plist you will get support for the corresponding encoding in TextEdit.
- Note that you will have to convert the hexadecimal values in CFStringEncodingExt.h to decimal values to put in Encodings.plist. I use PCalc to do this.
[Editor's note: I have not tried this tip...]
Comments (2)
Mac OS X Hints
http://hints.macworld.com/article.php?story=2002022602093458