Wired question related with Chinese characters

Adam D. Ruppe destructionator at gmail.com
Mon Mar 23 01:40:16 UTC 2020


On Monday, 23 March 2020 at 01:18:15 UTC, walker wrote:
> Which function should I use when I read Chinese characters in 
> the terminal?

Terminal.getline *might* work in my lib, but if there's combining 
codepoints I'm not sure. You can try it though and let me know if 
you are already using the lib.

There's also ReadConsole in core.sys.windows.windows that isn't a 
bad experience (just Windows only). It works with `wstring` just 
like WriteConsole and is the native function with unicode 
support. The operating system also manages some editing for the 
user, cursor placement, etc. so is more likely to work better 
with edge cases than my library's custom implementation of all 
that.

https://docs.microsoft.com/en-us/windows/console/readconsole


More information about the Digitalmars-d-learn mailing list