tags:

views:

356

answers:

1

I'm using the ibtool to localize my nibs. I run the following command:

ibtool --generate-strings-file MainMenu.strings en.lproj/MainMenu.nib

I then add the generated .strings file to the xcode project so that I can reference and edit it later.

When I do that, if I select the .strings file in xcode, it displays a bunch of upside question marks and garbage. However, if I choose not to add the file and manually open it using xcode, it reads the file perfectly.

I can only guess that ibtool is encoding the file in an unreadable xcode format.

If I open file .strings file in xcode, copy the contents to the clipboard, close the file, add the .strings file to xcode, replace its garbage contents w/ the contents in the clipboard, and then save the file, its fine. I also notice doing that will reduce the size of the .strings file by half.

Any guidance would be appreciated.

Thanks!

+4  A: 

Yes, somehow XCode fails to auto-detect the encoding of the generated file which is UTF-16 as required by specification. But when you add the generated file to XCode you have the option of choosing the character encoding (it defaults to UTF-8). There should be a dropdown for this right below the "Copy items into destination groups folder" checkbox. Just select UTF-16 and you should be fine. You can also choose the encoding in which XCode opens the file at any later time. To do this just right-click the strings file, select "get info" and you should get a drop down list of encodings.

mh0rkk