如何获取Windows下CMD命令框的编码?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

如何获取Windows下CMD命令框的编码?

sunbaole
处理邮件主题的程序需要在Windows下运行,由于适用多国语言,所以程序中的内
容以UTF-8编码处理,但是要在windows的DOS框中(程序- >运行->CMD)输出(编
码cp936)。
请问如何读取CMD命令框的编码。
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 如何获取Windows下CMD命令框的编码?

Jiahua Huang
能不能不要把能输入命令的都叫 DOS ……

>>> import sys
>>> sys.stdout.encoding
'UTF-8'
>>> sys.stdin.encoding
'UTF-8'


另外, Windows 下用控制台程序似乎不太那啥,
给 Gtk 或 Qt 加个简单的 GUI 吧

2008/1/17 sunbaole <[hidden email]>:
> 处理邮件主题的程序需要在Windows下运行,由于适用多国语言,所以程序中的内
> 容以UTF-8编码处理,但是要在windows的DOS框中(程序- >运行->CMD)输出(编
> 码cp936)。
> 请问如何读取CMD命令框的编码。
>
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 如何获取Windows下CMD命令框的编码?

techabc
In reply to this post by sunbaole
有点儿那个…… 借地儿问一下:如果只执行相应的功能而消除这个"命令行窗口框"?

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 如何获取Windows下CMD命令框的编码?

Jiahua Huang
Windows XP?
简单把你的 python 程序扩展名由 .py 改为 .pyw


2008/1/17 cherokee <[hidden email]>:
> 有点儿那个…… 借地儿问一下:如果只执行相应的功能而消除这个"命令行窗口框"?
>
>
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 如何获取Windows下CMD命令框的编码?

sunbaole
需要显示这个“命令窗口框”。
窗口用于查看各个邮件的主题内容。
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 如何获取Windows下CMD命令框的编码?

techabc
In reply to this post by Jiahua Huang
如果是在非python程序中呢,比如C++?

在08-1-17,Jiahua Huang <[hidden email]> 写道:
Windows XP?
简单把你的 python 程序扩展名由 .py 改为 .pyw


2008/1/17 cherokee <[hidden email]>:
> 有点儿那个…… 借地儿问一下:如果只执行相应的功能而消除这个"命令行窗口框"?
>


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 如何获取Windows下CMD命令框的编码?

Jiahua Huang
啥跟啥,

你写个 xxx.pyx,
里边用 os.popen 执行你的 C++ 控制台程序算了

2008/1/17 cherokee <[hidden email]>:
> 如果是在非python程序中呢,比如C++?
>
>
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 如何获取Windows下CMD命令框的编码?

techabc
ok, 多谢。

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese