2005年04月29日 星期五 12:25
各位好, 在pydev,NewEdit,Wing IDE里的运行环境里,当遇到语句 unicode(message, "utf8") 的执行,如遇message里包含汉字,都会报一下错误 exceptions.UnicodeEncodeError: 'ascii' codec can't encode characters in position 40-41: ordinal not in range(128) 但脚本在命令提示符下面直接运行脚本是没有这个错误的,这个给调试带来很大不便,大家都有遇到么?请问如何解决? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050429/97f8f490/attachment.htm
2005年04月29日 星期五 12:49
再转一下:
unicode(message, "utf-8").encode("cp936")
就可以了
在05-4-29,wang dy<dongyang.wang at gmail.com> 写道:
> 各位好,
> 在pydev,NewEdit,Wing IDE里的运行环境里,当遇到语句 unicode(message, "utf8")
> 的执行,如遇message里包含汉字,都会报一下错误
>
> exceptions.UnicodeEncodeError: 'ascii' codec can't encode characters in
> position 40-41: ordinal not in range(128)
>
> 但脚本在命令提示符下面直接运行脚本是没有这个错误的,这个给调试带来很大不便,大家都有遇到么?请问如何解决?
>
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
>
>
>
--
I like python!
My Donews Blog: http://www.donews.net/limodou
New Google Maillist: http://groups-beta.google.com/group/python-cn
Zeuux © 2025
京ICP备05028076号