Xcode 10, could not decode input file using specific encoding

Viewed 6644

I am working on an iOS app. It is working fine in Xcode 9.4.1, but when I build it in Xcode 10 it gives me following error:

Error

I tried the solution given in the following post by changing the encoding, but it didn't work. I tried it by both Reinterpret and Convert

enter image description here

still the same error:

enter image description here

It's working fine on Xcode 9.4.1

6 Answers

Find your Localizable.strings in a Terminal and execute:

$ iconv -f UTF-16LE -t UTF-8 Localizable.strings >  LocalizableNew.strings

Then check LocalizableNews.string and if there is no errors just replace files

$ mv LocalizableNew.strings Localizable.strings

I have similar error once i open my project in Xcode 10.4 and open it agian in Xcode 10.1.

I solved it by selecting my all Localizable.strings file and change there text encoding to UTF-16(In my case error was related to UTF-16 you can change it to UTF-8)

So changing the text encoding to UTF-16 or UTF-8 will works.

enter image description here enter image description here

It sounds like the file is corrupted, probably with parts of it encoded in UTF-8 and parts of it encoded in 8859-5. From its name, I would suspect this is a Cyrillic localization (perhaps Russian), and the file was probably edited using an editor that didn't correctly maintain encoding or use UTF-8 (the most common cause of that is editing on Windows).

You'll need to open the file, probably in an external editor that can handle random encodings like vim or Sublime Text, and fix any corruption. Exactly how to do that depends on the nature of the corruption.

You need to set correct Text Encoding in the File Inspector. The default is UTF-8.

If you want to fix the problem without UI, you need to look for the XCode project definition (generally YOURPROJECT.xcodeproj/project.pbxproj), then find the reference to the file causing an issue.

You should find something like this (from Adium, in this case)

D182F1B611DFF23700E33AE2 /* sk */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/schema.strings; sourceTree = "<group>"; };

fileEncoding = 10 is UTF-16; 4 is UTF-8, which is currently the default, so you can either set it to that value explicitely, or simply remove the fileEncoding bit altogether.

I got this error message when I forgot to put semicolons at the end of the line to separate the individual translations.

Related