[Win32utils-devel] Temporarily setting the output languageforcmd.exe
djberg96 at gmail.com
Fri Jan 18 20:27:33 EST 2008
Berger, Daniel wrote:
>> In my XP Prof, ping alway emits English whatsoever code page.
>> But in my Vista, ping emit different message for each code page.
>> chcp 437 && ping -n1 www.ruby-lang.org emits:
>> Active code page: 437
>> Pinging carbon.ruby-lang.org [22.214.171.124] with 32 bytes of data:
>> Reply from 126.96.36.199: bytes=32 time=287ms TTL=39
>> Ping statistics for 188.8.131.52:
>> Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
>> Approximate round trip times in milli-seconds:
>> Minimum = 287ms, Maximum = 287ms, Average = 287ms
> Ah, thanks.
> Here's another question. Why, if I set the code page to 437, does
> GetACP() return 1252?
> C:\Documents and Settings\djberge>chcp 437
> Active code page: 437
> C:\Documents and Settings\djberge>irb
> irb(main):001:0> require 'windows/national'
> => true
> irb(main):002:0> include Windows::National
> => Object
> irb(main):003:0> GetACP()
> => 1252
> I realise 1252 is "Latin 1" while 437 is "United States", but I'm
> curious why they're different here. Am I confusing two different things?
Whoops, nvermind. You have to use GetConsoleCP() to get the console code
page. GetACP() returns the system code page.
More information about the win32utils-devel