Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
July 29, 2019 How do I display unicode characters in D on standard (english) Windows 10 console window? | ||||
---|---|---|---|---|
| ||||
This is a very stupid question but from Ali's book, I took this segment: writeln("Résumé preparation: 10.25€"); writeln("\x52\ésum\u00e9 preparation: 10.25\€"); and after running it all I get is the following: R├⌐sum├⌐ preparation: 10.25Γé¼ R├⌐sum├⌐ preparation: 10.25Γé¼ I was expecting the symbol "£" or something like that. What am I missing? |
July 29, 2019 Re: How do I display unicode characters in D on standard (english) Windows 10 console window? | ||||
---|---|---|---|---|
| ||||
Posted in reply to WhatMeWorry | On Monday, 29 July 2019 at 22:17:55 UTC, WhatMeWorry wrote: > What am I missing? Switching the console code page to UTF-8, and then restoring the original one before termination. See https://github.com/ldc-developers/ldc/pull/3086/commits/5915534530fa095e7e5d58bcfb4ad100d249bbca#diff-c59e7716a40a08ce42f141c738f2c311. You may have to set a non-raster console font (e.g., Consolas). |
July 30, 2019 Re: How do I display unicode characters in D on standard (english) Windows 10 console window? | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke | On Monday, 29 July 2019 at 22:31:01 UTC, kinke wrote:
> Switching the console code page to UTF-8, and then restoring the original one before termination. See https://github.com/ldc-developers/ldc/pull/3086/commits/5915534530fa095e7e5d58bcfb4ad100d249bbca#diff-c59e7716a40a08ce42f141c738f2c311. You may have to set a non-raster console font (e.g., Consolas).
Just be advised, this was seriously broken in the past. Depends on windows, ms libraries, whether it's stdout or stderr and more. Current versions are probably ok, will check. Don't count on this to work on older windows including older Win10.
I always convert to/from console codepage to be safe.
|
July 30, 2019 Re: How do I display unicode characters in D on standard (english) Windows 10 console window? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Krejcirik | On Tuesday, 30 July 2019 at 12:06:23 UTC, Martin Krejcirik wrote:
> Just be advised, this was seriously broken in the past. Depends on windows, ms libraries, whether it's stdout or stderr and more. Current versions are probably ok, will check. Don't count on this to work on older windows including older Win10.
stderr was fixed with Win10 v1809.
|
July 31, 2019 Re: How do I display unicode characters in D on standard (english) Windows 10 console window? | ||||
---|---|---|---|---|
| ||||
Posted in reply to WhatMeWorry | On Monday, 29 July 2019 at 22:17:55 UTC, WhatMeWorry wrote: > This is a very stupid question but from Ali's book, I took this segment: > > > writeln("Résumé preparation: 10.25€"); > writeln("\x52\ésum\u00e9 preparation: 10.25\€"); > > > and after running it all I get is the following: > > > R├⌐sum├⌐ preparation: 10.25Γé¼ > R├⌐sum├⌐ preparation: 10.25Γé¼ > > > I was expecting the symbol "£" or something like that. What am I missing? In my Windows 10 build 1803 I was able to find a box to check to globally use the UTF-8 code page. Checking it requires a restart as it says the locale has changed. Settings>Time&Language>Region&Language>Administrative_Language_Settings brings up a Region dialog, and clicking on "Change system locale..." brought up a dialog where this box can be checked. After doing this the console acted sensibly right away with the code you wrote. |
Copyright © 1999-2021 by the D Language Foundation