May 25, 2011 [Issue 2742] std.stdio assumes console works in utf-8 | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2742 --- Comment #9 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-24 20:01:07 PDT --- According to this page http://codesnippets.joyent.com/posts/show/414 you can get and set the codepage via the [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage] key's OEMCP value. Setting the codepage requires a restart though. Also, changing the codepage has other effects, e.g. using ALT+Numpad keys is handled differently (with codepage 1252 you don't have to prepend a zero when using ALT+Numkey apparently). Here's how to fetch the value: import std.stdio; import std.windows.registry; void main() { Key HKLM = Registry.localMachine; Key SFW = HKLM.getKey(r"SYSTEM\CurrentControlSet\Control\Nls\CodePage"); auto codePage = SFW.getValue("OEMCP").value_SZ(); writeln(codePage); } Note that the key type is REG_SZ, a string, not a binary value. So if you want to set the code page programmatically, you have to call: SFW.setValue("OEMCP", "1252"); One more thing, there was this comment: "Change the code page in your registry and you may not be able to reboot your windows anymore." That sounds kind of scary. Perhaps all of this should be left to the user to do and just document it somewhere in the docs. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 25, 2011 [Issue 2742] std.stdio assumes console works in utf-8 | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2742 --- Comment #10 from Stewart Gordon <smjg@iname.com> 2011-05-25 04:59:10 PDT --- (In reply to comment #9) > According to this page http://codesnippets.joyent.com/posts/show/414 > you can get and set the codepage via the > [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage] key's OEMCP > value. > > Setting the codepage requires a restart though. Not if you do it using chcp on the command line, or (presumably) SetConsoleCP in the Windows API. > Also, changing the codepage has other effects, e.g. using ALT+Numpad keys is handled differently (with codepage 1252 you don't have to prepend a zero when using ALT+Numkey apparently). <snip> I don't have to prepend a zero anyway. It just produces a different character if I do. Traditionally at least, with a 0 it types a character from the ANSI set, and without a 0 it types a character from the OEM set. But as I test it (Win7), it depends on what font the command prompt is set to. ----- Lucida Console or Consolas ----- C:\Users\StewartGordon>chcp 850 Active code page: 850 C:\Users\StewartGordon>£úœ£ '£úœ£' is not recognized as an internal or external command, operable program or batch file. C:\Users\StewartGordon>chcp 1252 Active code page: 1252 C:\Users\StewartGordon>£úœ£ ----- Raster Fonts ----- C:\Users\StewartGordon>chcp 850 Active code page: 850 C:\Users\StewartGordon>£úo£ '£úo£' is not recognized as an internal or external command, operable program or batch file. C:\Users\StewartGordon>chcp 1252 Active code page: 1252 C:\Users\StewartGordon>ú·£ú ---------- The sequence of strange characters is Alt+0163, Alt+163, Alt+0156, Alt+156 in each case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 25, 2011 [Issue 2742] std.stdio assumes console works in utf-8 | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2742 Vladimir Panteleev <thecybershadow@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |thecybershadow@gmail.com --- Comment #11 from Vladimir Panteleev <thecybershadow@gmail.com> 2011-05-25 05:02:20 PDT --- Since no one seems to have mentioned this here yet: http://msdn.microsoft.com/en-us/library/ms686036(v=vs.85).aspx -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 26, 2011 [Issue 2742] std.stdio assumes console works in utf-8 | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2742 --- Comment #12 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-26 08:20:37 PDT --- And maybe this too (for input): http://msdn.microsoft.com/en-us/library/ms686013%28v=vs.85%29.aspx -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 23, 2012 [Issue 2742] std.stdio assumes console works in utf-8 | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2742 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|spec | CC| |bugzilla@digitalmars.com --- Comment #13 from Walter Bright <bugzilla@digitalmars.com> 2012-01-23 00:29:35 PST --- Not a language spec issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation