views:

30

answers:

1

My Localizable.strings file has somehow been corrupted and I don't know how to restore it.

If I open it as a Plain Text File it starts with weird characters that I can't copy here.

If I leave the file be the app builds. If I make any changes either the values aren't interpreted properly or I get an error at compile time.

Localizable.strings: Conversion of string failed. The string is empty.
Command /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings failed with exit code 1

I suspect this is an encoding problem but I don't know how it happened (maybe SVN is to blame?) nor how to solve it. Any tips will be much more appreciated.

A: 

I have issues with the same file that sound very similar to your own. What happens for me is that Xcode doesn't know the correct file formating. I often get this when rearranging the project and I remove and re-add this file to the Xcode project. When I re-add the file, its encoding gets set to something like Western Roman which can't seem to render anything other than ASCII.

Here's what I do to fix the problem:

  • In Xcode select the Localizable.stings file in the Groups&Files panel.

  • Do a Get Info on that file.

  • On the info panel select the General tab.

  • In that tab go to the File Encoding and change its value.

The last step is where the trick lies as you now have to guess the right encoding. I find that for most European languages that "Unicode (UTF-8)" works. And for Asian languages I find that "Unicode (UTF-16/32)" are the ones to try.

No one in particular