www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - String characters not extended

reply Ignacious <I.D.T ProjectMaya.com> writes:
when one prints out a string with some extended(I guess it's 
unicode), writeln prints out the ascii versions that do not 
correspond to what they really are. e.g., an umlaut is printed 
out as 1/2 or something.

how to get it to print the correct codes?
Jan 02
next sibling parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Monday, 2 January 2017 at 21:07:37 UTC, Ignacious wrote:
 when one prints out a string with some extended(I guess it's 
 unicode), writeln prints out the ascii versions that do not 
 correspond to what they really are. e.g., an umlaut is printed 
 out as 1/2 or something.

 how to get it to print the correct codes?
It should Just work. can you paste the source and output?
Jan 02
prev sibling next sibling parent bauss <jj_1337 live.dk> writes:
On Monday, 2 January 2017 at 21:07:37 UTC, Ignacious wrote:
 when one prints out a string with some extended(I guess it's 
 unicode), writeln prints out the ascii versions that do not 
 correspond to what they really are. e.g., an umlaut is printed 
 out as 1/2 or something.

 how to get it to print the correct codes?
Most likely not an issue with D, but your console's display encoding. Else your standard output might have ASCII as encoding and then you'd have to change it. What OS are you on?
Jan 02
prev sibling parent reply Anonymouse <asdf asdf.net> writes:
On Monday, 2 January 2017 at 21:07:37 UTC, Ignacious wrote:
 [...]
Assuming Windows: version(Windows) shared static this() { import core.sys.windows.windows; SetConsoleCP(65001); SetConsoleOutputCP(65001); }
Jan 03
parent reply Daniel =?iso-8859-1?b?S2964Ws=?= via Digitalmars-d-learn writes:
Anonymouse via Digitalmars-d-learn <digitalmars-d-learn puremagic.com>=20
napsal =C3=9At, led 3, 2017 v 12=E2=88=B634 :
 On Monday, 2 January 2017 at 21:07:37 UTC, Ignacious wrote:
 [...]
=20 Assuming Windows: =20 version(Windows) shared static this() { import core.sys.windows.windows; SetConsoleCP(65001); SetConsoleOutputCP(65001); }
Why do not use CP_UTF8 constant instead of 65001? It is safer, easier=20 to read and understand =
Jan 03
parent Anonymouse <asdf asdf.net> writes:
On Tuesday, 3 January 2017 at 19:40:20 UTC, Daniel Kozák wrote:
 Why do not use CP_UTF8 constant instead of 65001? It is safer, 
 easier to read and understand
I have no reason to back it up with. I'm literally just copy/pasting what others have suggested I use.
Jan 04