[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: UTF-8 and the Windows console
- From: Matthias Kluwe <mkluwe@...>
- Date: Mon, 30 Mar 2009 20:58:38 +0200
Hi!
2009/3/30 Esteban Santana Santana <mentalpower@gmail.com>:
> Seems to work fine here (WinVista 32-bit SP1, running Lua for Windows [Lua
> v5.1.4.23]), both when doing a copy-paste from the email and when typing the
> é manually via keyboard.
>
> Microsoft Windows [Version 6.0.6001]
> Copyright (c) 2006 Microsoft Corporation. All rights reserved.
>
> C:\Users\User>lua
> Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
>> print'é'
> é
Thanks for trying. Did you enter 'chcp 65001' before?
BTW, there's nothing lua specific in here, my sample program mentioned
in m.p.w.p.international
#include "windows.h"
#include <iostream>
int main() {
SetConsoleCP( CP_UTF8 );
char line[100];
while ( std::cin.getline( line, 100 ) )
std::cout << line << std::endl;
}
fails as well.
Regards,
Matthias
> On Mon, Mar 30, 2009 at 1:49 PM, Matthias Kluwe <mkluwe@gmail.com> wrote:
>>
>> Hi!
>>
>> This may not be the right place to ask, but some people reading here
>> may have experienced the same problem and know what I'm talking
>> about...
>>
>> So, hopefully someone on this list has insight about the behavior of
>> the MS Windows (XP) console regarding UTF-8 encoded data.
>>
>> The windows console does work with UTF-8 if the “codepage” is set to
>> the value 65001, apparently (command chcp 65001). I used lue5.1.exe
>> from luabinaries.luaforge.net for a test (and a self-built lua.exe)
>> with the command
>>
>> > print’é’
>>
>> This made the interpreter exit immediately, without any message.
>>
>> Do you have any idea what’s happening here?
>>
>> Executing a script file containing the command above (encoded in
>> UTF-8) works perfectly in the console…
>>
>> I tried to discuss this on
>> microsoft.public.win32.programmer.international. See the thread
>> 'Reading UTF-8 input from the console'
>>
>> (http://groups.google.com/group/microsoft.public.win32.programmer.international/browse_thread/thread/e38aa923a32c20f9/1a3fa3c367732a76#1a3fa3c367732a76).
>>
>> Regards,
>> Matthias