代码之家  ›  专栏  ›  技术社区  ›  Akshay Sunderwani

Xcode 10,无法使用特定编码解码输入文件

  •  0
  • Akshay Sunderwani  · 技术社区  · 6 年前

    Error

    我试过了 solution given in the following post 通过改变编码,但没用。我尝试了重新解释和转换

    enter image description here

    还是同样的错误:

    enter image description here

    在xcode9.4.1上运行良好

    4 回复  |  直到 5 年前
        1
  •  4
  •   Rob Napier    6 年前

    您将需要打开该文件,可能是在一个外部编辑器中,该编辑器可以处理诸如vim或Sublime Text之类的随机编码,并修复任何损坏。具体如何做到这一点取决于腐败的性质。

        2
  •  11
  •   Pang firemonkey    6 年前

    在终端中查找Localizable.strings并执行:

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

    $ move LocalizableNew.strings Localizable.strings
    
        3
  •  6
  •   guru    5 年前

    当我在xcode10.4中打开我的项目并在xcode10.1中再次打开它时,我也有类似的错误。

    我通过选择all Localizable.strings文件并将其文本编码更改为UTF-16解决了这个问题(在我的例子中,错误与UTF-16有关,您可以将其更改为UTF-8)

    因此,将文本编码更改为UTF-16或UTF-8将起作用。

    enter image description here enter image description here

        4
  •  2
  •   marko    6 年前

    你得把它调正 文本编码 文件检查器 . 默认值是UTF-8。

        5
  •  2
  •   Olivier Mehani    5 年前

    如果您想在没有UI的情况下解决这个问题,您需要查找XCode项目定义(通常是 YOURPROJECT.xcodeproj/project.pbxproj ),然后找到引起问题的文件的引用。

    你应该找到这样的东西(在这种情况下,来自Adium)

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

    fileEncoding = 10 4 fileEncoding 一点一滴。

        6
  •  0
  •   Palimondo    5 年前

    当我忘记在行尾加分号来分隔各个翻译时,我收到了这个错误消息。