我有一个返回UTF-16编码字符串的函数,我需要使用替换操作将其结果包含到另一个字符串中:
string = myfunc()
debug_string = debug_string.replace("$rep$", string)
在我的Eclipse环境中它可以正常运行,但在另一个环境中会出现错误:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 23: ordinal not in range(128)
你知道可能的原因是什么吗?
谢谢