Localizable.strings - data cannot be read because it is not in the correct format

If I copy something from textedit or web and paste it into a localized file, this will show this compilation error. If I enter them into a localized file, this does not produce any error. I assure you that I am using the correct format and ';' in file.

"New" = "New"; "In Progress" = "In Progress"; "Waiting" = "Waiting"; "Closed" = "Closed"; 
+40
source share
15 answers

It seems that SVN has some problems with this file. According to him, this is a binary file. It inserts many non-printable characters between each character. I still could not find the right solution. Just modify the Localizable.string files from your work computer to avoid any problems with it.

Update: updating the SVN client (smartSVN) to the latest version resolved the issue. It seems that one of my colleagues used an older version. When he committed the change to the localized file, this caused an error.

-2
source
  • Use plutil from the terminal:

you need to run it for each version of the localized file. for instance

  • cd to the project root directory
  • cd eb.lproj - you can replace this with any localization you work with.
  • plutil -lint Localizable.strings

When you run step 3, you will either be shown an error telling you what is wrong with your file. Or you will be told that the file is OK

+117
source

For me there were no half-columns. If you use the tool to generate the .strings file, make sure there are no hidden quotes that can "eat" the separation half-columns.

+29
source

pl & lt; Localizable.strings is better than plutil -lint Localizable.strings

The magazine will show something like this

2019-08-14 16: 39: 34.066 pl [21007: 428513] CFPropertyListCreateFromXMLData (): old-style parser: missing a semicolon in the dictionary on line 427. The parsing will stop. Break on _CFPropertyListMissingSemicolon for debugging. 2019-08-14 16: 39: 34.068 pl [21007: 428513] CFPropertyListCreateFromXMLData (): old-style parser: missing a semicolon in the dictionary on line 427. The parsing will stop. Break on _CFPropertyListMissingSemicolon for debugging. 2019-08-14 16: 39: 34.071 pl [21007: 428513] *** ASCII parsing property list: NSParseErrorException Error Domain = NSCocoaErrorDomain Code = 3840 "Unexpected character / on line 1" UserInfo = {NSDebugDescription = Unexpected character / at line 1, kCFPropertyListOldStyleParsingError = Domain Error = NSCocoaErrorDomain Code = 3840 "Missing"; line 427 'UserInfo = {NSDebugDescription = Missing'; ' on line 427}}

+4
source

I had the same problem and solved it by commenting or deleting unused lines in the Localizable.String file :)

+3
source

In my case, I skipped "=" between a pair of lines. Even the rogue didn't help me detect the error string. I manually checked every couple of lines. : /

+3
source

Your syntax seems fine, the only thing I see can “break” your file and cause this error - a quote symbol. Be sure to use reqular one " , but not in any other form, for example .

+2
source

Also make sure the string file name is always Localizable.strings

+1
source

Once I had a similar error, and it turned out that there was a URL in the middle of the file, for example like this:

 // Some Comment 1 "Some key 1" = "Some value 1"; http://...whatever... // Some Comment 2 "Some key 2" = "Some value 2"; 

When plutil -lint for this file, the output was:

 Unexpected character / at line 1 

Well, the first character really was / how the file started with a comment, but the problem was solved after removing the URL; or turn it into a comment that really should have been. Note that the URL was far from the beginning of the line file; it was in the middle of the line file of 6000 lines. I could only find it by looking at the commit history and always looking at the changes.

+1
source

It seems your info.plist is not in the correct form. check it correctly. I had the same problem too. I solved this by changing my info.plist.

0
source

I had a similar problem when I did not escape the string value with backslash \ for one of my string values.

Before:

"INVALID_NUMBER" = "It seems you are entering the wrong number. The number should start with" 0 "or" 7 "";

Updated:

"INVALID_NUMBER" = "It seems you are entering the wrong number. The number should start with \" 0 \ "or \" 7 \ "";

A backslash is required when you want to display quotation marks "

Please see How to include quotation marks in strings.

0
source

I just had this experience:

  • an external translator does the work inside Visual Code or other text editors
  • Files do not work and produce an error similar to this: (testing with plutil -lint)

    Localizable.strings: Unexpected character " at line 1 CardRatingView.strings: Unexpected character/at line 2

I just created a new file in Xcode and copied the entire contents of the file, and suddenly everything worked correctly.

I assume that something may go wrong / damage the file itself when working with other text editors.

0
source

I ran into this problem, all my formatting was correct. Checking for invalid characters with plutil -lint Localizable.strings and using ruby ​​libraries such as "utf8_utils" also does not "utf8_utils" find invalid characters. BUT, when I pasted the contents of Localizable.strings into a Terminal application when I irb , it showed me strange characters.

 "PercentComplete" = "%d procent gennemført"; 

Paste in IRB:

 "PercentComplete"\U+FFC2\U+FFA0= "%d procent gennemf\U+FFC3\U+FFB8rt"; 

Then all I had to do was replace the regex to fix these weird space characters: \U+FFC2\U+FFA0

0
source

in my case, the syntax error seems to be missing "

0
source

If Unexpected character " at line 1, and it is the first string like "app_name"="Any Name" something like Unexpected character " at line 1, and it is the first string like "app_name"="Any Name"

Make sure the UTF16 file

-1
source

Source: https://habr.com/ru/post/1272867/


All Articles