22 Jul
2009
22 Jul
'09
6:15 p.m.
Hi.
We have to use "IME" to input non-ascii charactor in Windows. When "> chcp 65001" in cmd.exe, we cannot use IME on cmd.exe.
So setting codepage to 65001 make output universal but make input ascii-only. Sit!!!
Is there a code page that still allows IME input, but supports all of Unicode? I know there is GB18030 - is it any good?
I found WriteConsoleW() API recently.
This API can write utf16 string to console directly, without change
OutputCodepage.
example:
http://bitbucket.org/methane/hg-fixutf8-jp/src/tip/win32helper.py#cl-42
I think this API is good for py3k.
When stdout is console and not redirected to [pipe|file],
sys.stdout.write(u"foo")
can avoid encoding and use WriteConsoleW(L"foo")
--
Naoki INADA