I am learning how to localize the strings in my project and I am using Xcode 4.
I have generated the base Localizable.strings file, and I want to import this file, changing its encoding from utf-16 to Unicode utf-16 so that the text in the file is readable within xCode. If I strate import this file, when I select it within xcode, the text shows up as gibberish.
In Xcode 3 when you drag the Localizable.strings into your project, the dialog box which appears gives you the option to change the text encoding, but this is not the case in Xcode 4.
Does anyone know a way around this?
Maybe this can help you Objective C/Xcode 4: Encoding Problem with Localizable.strings files
These kind of errors can happen if you copy and paste content within Xcode or from external files in your localization files. The consequence is that the encoding of the file changes to for example Western (Mac OS Roman). The Localizable.strings file should be in UTF-16 though.
Solution
1. Like in the picture below, navigate in Xcode to the Localizable.strings location and open it so that you can see all the languages you are supporting.
Left-click on the language file the causes the build error.
Make sure your Utilities View is showing in Xcode. Activate on the button at mark 1 in Picture below.
In the Utilities View select the File Inspector. (Small Logo that looks like Page)
Under Text Settings change the encoding to UTF-16(Marked as 2 in the picture above). The Drop-Down might be grayed out but you can click on it anyways. Click on "Convert" on the Popup.
That's it your project should now compile again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With