Localizable.strings - The data couldn’t be read because it isn’t in the correct format

前端 未结 18 1184
广开言路
广开言路 2021-01-30 06:20

If I copy something from textedit or web and paste it to localizable file it shows this compilation error. If I type those in localizable file it does not show any error. I am a

相关标签:
18条回答
  • 2021-01-30 06:50

    There can be multiple reasons for this:

    1. Semi-colon is missing.
    2. Invalid white space in file.
    3. Other invalid characters in file.
    4. I had merge conflict characters in it!

    <<<<<<< HEAD, ======= and >>>>>>>.

    Please note that plutil -lint Localizable.strings returned OK for point-4!

    0 讨论(0)
  • 2021-01-30 06:50

    Thanks to the plutil suggestion I understood that to make it work you have to delete also any \ or * as are not read as comments and, important, add a ; to the end of the file. Xcode 11.5.

    0 讨论(0)
  • 2021-01-30 06:51

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

    Check that the file is UTF16

    0 讨论(0)
  • 2021-01-30 06:52

    I was having the similar issue where i didn't escape the string value with backslash \ for one of my string's value.

    Before:

    "INVALID_NUMBER" = "It seems you're entering invalid number. Number should starts with "0" or "7"";

    Updated:

    "INVALID_NUMBER" = "It seems you're entering invalid number. Number should starts with \"0\" or \"7\"";

    Backslashes are required when you want to display the quotation marks "

    Please, have a quick look at here for How to include Quotation mark in strings

    0 讨论(0)
  • 2021-01-30 06:53

    I just had this experience:

    • external translator doing the work inside Visual Code or other text editors
    • Files not working and getting an error like this one: ( testing with plutil -lint )

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

    I just created a new file within XCode and copy pasted all the file content and suddenly everything was working properly.

    I guess something can go wrong / corrupting the file itself while working with other text editors.

    0 讨论(0)
  • 2021-01-30 06:54

    It seems your info.plist is not in correct form . check it properly. I also had the same issue . I resolved it by modifying my info.plist.

    0 讨论(0)
提交回复
热议问题