Skip to content

"cocos run -p web" raises UnicodeEncodeError in Traditional Chinese Windows #419

Open
@whitglint

Description

@whitglint

Error

cocos run -p web
編譯模式:debug
部署模式:debug
Traceback (most recent call last):
File "C:\cocos2d-x-3.15\tools\cocos2d-console\bin/cocos.py", line 1027, in
run_plugin(command, argv, plugins)
File "C:\cocos2d-x-3.15\tools\cocos2d-console\bin/cocos.py", line 916, in run_plugin
plugin.run(argv, dependencies_objects)
File "C:\cocos2d-x-3.15\tools\cocos2d-console\plugins\plugin_run\project_run.py", line 341, in run
self.parse_args(argv)
File "C:\cocos2d-x-3.15\tools\cocos2d-console\bin\cocos.py", line 615, in parse_args
self._add_custom_options(parser)
File "C:\cocos2d-x-3.15\tools\cocos2d-console\plugins\plugin_run\project_run.py", line 56, in _add_custom_options
help=MultiLanguage.get_string('RUN_ARG_NO_CONSOLE'))
File "C:\cocos2d-x-3.15\tools\cocos2d-console\bin\MultiLanguage.py", line 52, in get_string
fmt = cls.get_instance().get_current_string(key)
File "C:\cocos2d-x-3.15\tools\cocos2d-console\bin\MultiLanguage.py", line 158, in get_current_string
ret = ret.encode(self.encoding)
UnicodeEncodeError: 'cp950' codec can't encode character u'\u7ed9' in position 56: illegal multibyte sequence

Fix

There are some Simplified Chinese characters in Traditional Chinese string in bin/strings.json file:

  • Line 746:
    Incorrect:
    "RUN_ARG_NO_CONSOLE" : "關閉 Windows,Mac 和 Linux 下的模擬器控制檯視窗(傳入命令行參數 '-console no' 给模擬器)。",
    Correct:
    "RUN_ARG_NO_CONSOLE" : "關閉 Windows,Mac 和 Linux 下的模擬器控制檯視窗(傳入命令行參數 '-console no' 給模擬器)。",

  • Line 747:
    Incorrect:
    "RUN_ARG_WORKING_DIR" : "設定 Windows,Mac 和 Linux 下模擬器運行的工作目錄(傳入命令行參數 '-workdir \"<path>\"' 给模擬器)。",
    Correct:
    "RUN_ARG_WORKING_DIR" : "設定 Windows,Mac 和 Linux 下模擬器運行的工作目錄(傳入命令行參數 '-workdir \"<path>\"' 給模擬器)。",

  • Line 871:
    Incorrect:
    "COMPILE_INFO_USE_COCOAPODS" : "檢測到 CocoaPods:使用 xcworkspace 进行编译。",
    Correct:
    "COMPILE_INFO_USE_COCOAPODS" : "檢測到 CocoaPods:使用 xcworkspace 進行編譯。",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions