Xcode:Localized.strings:字符串转换失败。该字符串为空。复制字符串失败,退出代码为 1
我使用 Localized.strings 文件,并将应用程序中的字符串替换为 NSLocalizedString(@"KEY",@" COMMENT")。
到目前为止,我更换了很多琴弦,效果很好。我添加了更多字符串,现在收到以下错误消息:
复制字符串文件 构建/调试-iphoneos/Australia.app/en.lproj/Localizable.strings en.lproj/Localized.strings cd /用户/regisandre/桌面/XCode/AUSTRALIAENINT setenv ICONV /usr/bin/iconv setenv 小路 “/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin” /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings --validate --inputencoding utf-8 --outputencoding 二进制 en.lproj/Localized.strings --outdir /Users/regisandre/Desktop/XCode/AUSTRALIAENINT/build/Debug-iphoneos/Australia.app/en.lproj en.lproj/Localized.strings: 字符串转换失败。这 字符串为空。 en.lproj/Localized.strings: 字符串转换失败。这 字符串为空。命令 /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings 失败,退出代码为 1
更新:
你是对的!这是UTF-8/UTF-16编码的问题。使用 genstrings 生成文件后,有必要避免从其他文件(甚至从 Xcode)复制/粘贴字符串文件,因为这会引起一些编码问题。
一旦使用 Xcode 生成文件,所有修改都必须通过“键盘直接输入”直接在文件中完成;没有复制/粘贴! (除非您确定复制/粘贴的格式正确,但似乎不太容易知道)
I use a Localizable.strings file and replaces the strings in my app with NSLocalizedString(@"KEY",@" COMMENT").
I replaced up to now a lot of strings and it worked well. I have added some more strings and now I have got the following error message :
CopyStringsFile
build/Debug-iphoneos/Australia.app/en.lproj/Localizable.strings
en.lproj/Localizable.strings cd
/Users/regisandre/Desktop/XCode/AUSTRALIAENINT
setenv ICONV /usr/bin/iconv setenv
PATH
"/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings
--validate --inputencoding utf-8 --outputencoding binary en.lproj/Localizable.strings --outdir
/Users/regisandre/Desktop/XCode/AUSTRALIAENINT/build/Debug-iphoneos/Australia.app/en.lproj
en.lproj/Localizable.strings:
Conversion of string failed. The
string is empty.
en.lproj/Localizable.strings:
Conversion of string failed. The
string is empty. Command
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings
failed with exit code 1
Update:
You are right ! It was a question of UTF-8/UTF-16 encoding. Once the file generated with genstrings, it is necessary to avoid copy/paste in the strings file from other files (even from Xcode) as it induces some encoding issues.
Once the file generated with Xcode, all the modifications have to be done directly in the file by "direct typing with the keayboard" ; no copy/paste ! (except if you are sure that the format you copy/paste is correct but it seems not so easy to know)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当其中有特殊符号时,检查是否是UTF-8编码。
Check if it's UTF-8 encoding when it has special symbols in it.