How to print unicode characters (no library)?

Adam D Ruppe destructionator at gmail.com
Mon Dec 27 14:30:55 UTC 2021


On Monday, 27 December 2021 at 11:21:54 UTC, rempas wrote:
> So should I just use UTF-8 only for Linux?

Most unix things do utf-8 more often than not, but technically 
you are supposed to check the locale and change the terminal 
settings to do it right.

> But what about Windows?

You should ALWAYS use the -W suffix functions on Windows when 
available, and pass them utf-16 encoded strings.

There's a bunch of windows things taking utf-8 nowdays too, but 
utf-16 is what they standardized on back in the 1990's so it 
gives you a lot of compatibility. The Windows OS will convert to 
other things for you it for you do this utf-16 consistently.

> Unfortunately I have to support this OS too with my library so 
> I should know.

The Windows API is an absolute pleasure to work with next to much 
of the trash you're forced to deal with on Linux.


More information about the Digitalmars-d-learn mailing list