2004年05月24日 星期一 13:01
info,您好! 如果使用unicode版本的话,首先根据文件的编码方式转成unicode,然后再加入到wxPython中即可。如,使用cp936编码(简体中文windows的缺省编码方式),可以: text=open(filename, 'rb').read() s = unicode(text, 'cp936') 再将s插入到编辑器中即可。 如果已经知道文件为utf-8编码,可以 text=open(filename, 'rb').read() s = unicode(text, 'utf-8') ======= 2004-05-24 10:30:39 您在来信中写道:======= >python-chinese,您好! > 我使用的是freebsd4.8的系统+kde3.1,在kde下能正确显示中文和繁体字。通过内置的编辑工具也能以gb18030、gb2312和utf-8方式查看代码中的中文,但是用utf-8方式查看源文件显示为乱码。 > > > 致 >礼! > > > info > info at xichen.com > 2004-05-24 >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese > = = = = = = = = = = = = = = = = = = = = 致 礼! limodou chatme at 263.net 2004-05-24
2004年05月24日 星期一 12:14
i can't follow u what is out?
2004年05月24日 星期一 14:03
limodou,您好! 谢谢了,如果是菜单上的中文,如何操作呢? ======= 2004-05-24 13:01:33 您在来信中写道:======= >info,您好! > > 如果使用unicode版本的话,首先根据文件的编码方式转成unicode,然后再加入到wxPython中即可。如,使用cp936编码(简体中文windows的缺省编码方式),可以: >text=open(filename, 'rb').read() >s = unicode(text, 'cp936') >再将s插入到编辑器中即可。 >如果已经知道文件为utf-8编码,可以 >text=open(filename, 'rb').read() >s = unicode(text, 'utf-8') > >======= 2004-05-24 10:30:39 您在来信中写道:======= > >>python-chinese,您好! >> 我使用的是freebsd4.8的系统+kde3.1,在kde下能正确显示中文和繁体字。通过内置的编辑工具也能以gb18030、gb2312和utf-8方式查看代码中的中文,但是用utf-8方式查看源文件显示为乱码。 >> >> >> 致 >>礼! >> >> >> info >> info at xichen.com >> 2004-05-24 >>_______________________________________________ >>python-chinese list >>python-chinese at lists.python.cn >>http://python.cn/mailman/listinfo/python-chinese >> > >= = = = = = = = = = = = = = = = = = = = > > > 致 >礼! > > > limodou > chatme at 263.net > 2004-05-24 > >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese > = = = = = = = = = = = = = = = = = = = = 致 礼! info info at xichen.com 2004-05-24
2004年05月24日 星期一 14:34
limodou,您好!
我按照你的方法,将源代码更改为:
menu = wxMenu()
menu.Append(ID_START, (unicode("启动服务", 'gb2312')), "启动短信收发服务")
menu.Append(ID_STOP, "停止服务", "停止短信收发服务")
在windows2000平台下提示错误:
menu.Append(ID_START, (unicode("启动服务", 'gb2312')), "启动短信收发服务")
File "C:\PYTHON23\Lib\site-packages\wx\core.py", line 7314, in Append
return _core.Menu_Append(*args, **kwargs)
TypeError: Unable to convert string
请给予指点,谢谢!
======= 2004-05-24 13:01:33 您在来信中写道:=======
>info,您好!
>
> 如果使用unicode版本的话,首先根据文件的编码方式转成unicode,然后再加入到wxPython中即可。如,使用cp936编码(简体中文windows的缺省编码方式),可以:
>text=open(filename, 'rb').read()
>s = unicode(text, 'cp936')
>再将s插入到编辑器中即可。
>如果已经知道文件为utf-8编码,可以
>text=open(filename, 'rb').read()
>s = unicode(text, 'utf-8')
>
>======= 2004-05-24 10:30:39 您在来信中写道:=======
>
>>python-chinese,您好!
>> 我使用的是freebsd4.8的系统+kde3.1,在kde下能正确显示中文和繁体字。通过内置的编辑工具也能以gb18030、gb2312和utf-8方式查看代码中的中文,但是用utf-8方式查看源文件显示为乱码。
>>
>>
>> 致
>>礼!
>>
>>
>> info
>> info at xichen.com
>> 2004-05-24
>>_______________________________________________
>>python-chinese list
>>python-chinese at lists.python.cn
>>http://python.cn/mailman/listinfo/python-chinese
>>
>
>= = = = = = = = = = = = = = = = = = = =
>
>
> 致
>礼!
>
>
> limodou
> chatme at 263.net
> 2004-05-24
>
>_______________________________________________
>python-chinese list
>python-chinese at lists.python.cn
>http://python.cn/mailman/listinfo/python-chinese
>
= = = = = = = = = = = = = = = = = = = =
致
礼!
info
info at xichen.com
2004-05-24
Zeuux © 2025
京ICP备05028076号