jojopi wrote:UTF-8 is unambiguous without lookahead. I still do not understand your point about Windows having to expose a special console API.
Same sorts of problems I am no doubt going to ask you about if this all works. How do I select the font onto the console etc.
So when Windows changed the console to draw using unicode etc it could suddenly be resize to any scale. They added a whole pile of stuff you need to be able to play width absolute screen size, font size, colours etc etc. You can see it all by right clicking on the top right icon of the console and it has its own dialog. Obviously we also need to be able to access all that stuff from within the console program so I can choose my size and font etc myself.
The original console was a shell it had no message queue or thread so no way to communicate to real Windows stuff. Long and short you need allow the console to access parts of the subsystem all the while maintaining security so they set it on it's own API. It your interested here is the full list
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
The ones we would definitely need are the Linux equivalents to
SetCurrentConsoleFontEx .... change the console font obviously
SetConsoleTextAttribute ... change the text colour arrangements
probably set screen size but that is not so important users can do that and set default
You will note on windows they API the keyboard with it's own calls
They tell you why on the functions "it can read in either Unicode (wide-character) or ANSI mode." basically it knows what to do by what font I have selected.
That was what I was saying to David you don't even write console apps that way on Windows anymore that is for old DOS zealots and die hards. Obviously that old legacy junk works for now but it's pretty ugly when you have a gleaming new API with all the calls just sitting there waiting for you. It's child play to write multilingual Apps it requires one step select an appropriate font for the console.