How to encode / convert a .strings file into UTF-16LE in Xcode

When you create a new .strings file in Xcode it will be encoded as Unicode UTF-8. That’s sufficient to hold all the special characters you can dream of.

Some translation services such as ICanLocalize require .strings files to be submitted in UTF-16LE though. Puzzled about what this even means I found out that UTF-16LE can hold languages such as Chinese and Hindu in smaller sizes than UTF-8 could. It’s a bit theoretical, but the good news is that Xcode 5 can change this very easily:

  • select your file in Xcode
  • open the right hand pane and select the File Inspector (little piece of paper icon)
  • under Text Settings, find a drop down menu that lets you select a new encoding method for your file

Screen Shot 2013-11-24 at 19.37.05

Xcode will offer to either re-interpret the current file, or to convert it. Choose the latter and save your file (CMD+S), and all is well again with the world.

You can now choose to upload your file for a free quote:

Xcode only builds with UTF-8

Note that once you change this format, Xcode may complain that it can no longer build your app, with an error message such as
Copy .strings Error – Read failed: The data couldn’t be read because it isn’t in the correct format.

In which case, just change it back to UTF-8, choose convert and build again successfully.

Further reading:

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

One thought on “How to encode / convert a .strings file into UTF-16LE in Xcode

  1. If the error persists:
    Note that you can set the encoding format of each file within the strings group. The top level will be encoded like your base translation is, but other files may have a different format set.

    Click on each one and investigate if it’s set to UTF-8, and if not, set it to UTF-8. Then build again.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.