本文介绍了如何在Xcode 4中更改Localizable.strings文件的文本编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在学习如何在我的项目中本地化字符串,我正在使用Xcode 4.I am learning how to localize the strings in my project and I am using Xcode 4.我已经生成了基本的Localizable.strings文件,我想要导入此文件,将其编码从utf-16更改为Unicode utf-16,以便文件中的文本在xCode中可读。如果我策略导入这个文件,当我在xcode中选择它时,文本显示为乱码。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.在Xatab 3中将Localizable.strings拖动到项目中时,出现的对话框提供了更改文本编码的选项,但情况并非如此在Xcode 4中。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?推荐答案也许这可以帮到你目标C / Xcode 4:使用Localizable.strings文件编码问题如果您在Xcode中复制和粘贴内容,或者从本地化文件中的外部文件复制和粘贴,则会发生这类错误。结果是文件的编码变为例如Western(Mac OS Roman)。 Localizable.strings文件应该是UTF-16。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.解决方案 1。 如下图所示,在Xcode中导航到Localizable.strings位置并打开它,这样就可以看到你支持的所有语言。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.确保您的Utilities View显示在Xcode中。激活下图中标记1处的按钮。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)在文本设置下,将编码更改为UTF-16(上图中标记为2)。 Drop-Down可能会显示为灰色,但无论如何都可以单击它。点击弹出窗口中的转换。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. 这篇关于如何在Xcode 4中更改Localizable.strings文件的文本编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-02 08:28