how to localize console and GUI apps in Windows

Andrei aalub at mail.ru
Wed Jan 3 15:50:23 UTC 2018


On Wednesday, 3 January 2018 at 09:11:32 UTC, thedeemon wrote:
> Windows API contains two sets of functions: those whose names 
> end with A (meaning ANSI), the other where names end with W 
> (wide characters, meaning Unicode). The sample uses TextOutA, 
> this function that expects 8-bit encoding.

Gosh, I should new this :)) Thanks for the point! TextOutW() 
works fine with wstring texts in this example and no more changes 
needed.

That's just enough for this example. Thank you!

Yet my particular interest is console interconnections. With the 
help of this forum I've learned console settings to write 
Cyrillic properly and simply to the console using UTF8 encoding.

One thing that remains is to read and process the user's input.

For now in the example I've cited above response=readln(); 
statement returns an empty string, in a console set for UTF8 code 
page, if the user's input contains any Cyrillic letters. Then the 
program's behavior differs depending on the compiler (or more 
likely on the runtime library): the one compiled with ldc 
continues to read on and returns empty lines, instead of the 
user's input, and the one compiled with dmd only returns empty 
lines not waiting for the user's input and not actually reading 
anything (i.e. it falls into indefinite loop busily printing 
empty response hundreds times a second).

That's only for localized input. With ASCII input same program 
works fine.

May be there is some more settings I must learn to set console to 
properly read non-ASCII input?



More information about the Digitalmars-d-learn mailing list