cocos2d-x 在 windows CMD 出現 UnicodeEncodeError 的解法 (cocos with UnicodeEncodeError)

在安裝 cocos2d-x 以後,要在 cmd 中執行 cocos 時發生以下問題:
C:\My_cocos_dev>cocos
Traceback (most recent call last):
  File "C:\My_cocos_dev\cocos2d-x\tools\cocos2d-console\bin\/cocos.py", line 1053, in 
    DataStatistic.show_stat_agreement(skip_agree_value)
  File "C:\My_cocos_dev\cocos2d-x\tools\cocos2d-console\bin\/cocos.py", line 346, in show_stat_agreement
    input_value = raw_input(MultiLanguage.get_string('COCOS_AGREEMENT'))
  File "C:\My_cocos_dev\cocos2d-x\tools\cocos2d-console\bin\MultiLanguage.py", line 52, in get_string
    fmt = cls.get_instance().get_current_string(key)
  File "C:\My_cocos_dev\cocos2d-x\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'\u53a6' in position 16: illegal multibyte sequence

解決方法:
將 MultiLanguage.py 的第 158 行修改一下,把以下程式碼
ret = ret.encode(self.encoding)

更改為↓即可
ret = ret.encode(self.encoding, "ignore")

留言