Daniel Berger
2008-Jan-18 03:05 UTC
[Win32utils-devel] Temporarily setting the output language for cmd.exe
Hi all, One of the net-ping users reported that the Net::Ping::External library was returning false positives on Vista. Basically, it does a ''ping -n1 host'' and checks for certain error strings. The problem is that the error strings it checks for are in English. The user in question is using a cmd.exe that''s entirely in Swedish (I think). Is there any way I can temporarily set the language of the command console so that it emits English only? I tried setlocale() but that didn''t work. Perhaps a registry setting somewhere? Or an explicit ''cmd /c'' call with some other special option? Thanks, Dan
Heesob Park
2008-Jan-18 04:02 UTC
[Win32utils-devel] Temporarily setting the output language for cmd.exe
Hi, 2008/1/18, Daniel Berger <djberg96 at gmail.com>:> > Hi all, > > One of the net-ping users reported that the Net::Ping::External library > was returning false positives on Vista. Basically, it does a ''ping -n1 > host'' and checks for certain error strings. > > The problem is that the error strings it checks for are in English. The > user in question is using a cmd.exe that''s entirely in Swedish (I think). > > Is there any way I can temporarily set the language of the command > console so that it emits English only? I tried setlocale() but that > didn''t work. Perhaps a registry setting somewhere? Or an explicit ''cmd > /c'' call with some other special option? > > Thanks, > > DanIn the cmd.exe console window, Run "chcp 437". Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080118/c7f96a1c/attachment.html
Berger, Daniel
2008-Jan-18 15:34 UTC
[Win32utils-devel] Temporarily setting the output language forcmd.exe
> -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of > Heesob Park > Sent: Thursday, January 17, 2008 9:03 PM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Temporarily setting the > output language forcmd.exe > > Hi, > > > 2008/1/18, Daniel Berger <djberg96 at gmail.com>: > > Hi all, > > One of the net-ping users reported that the > Net::Ping::External library > was returning false positives on Vista. Basically, it > does a ''ping -n1 > host'' and checks for certain error strings. > > The problem is that the error strings it checks for are > in English. The > user in question is using a cmd.exe that''s entirely in > Swedish (I think). > > Is there any way I can temporarily set the language of > the command > console so that it emits English only? I tried > setlocale() but that > didn''t work. Perhaps a registry setting somewhere? Or > an explicit ''cmd > /c'' call with some other special option? > > Thanks, > > Dan > > > In the cmd.exe console window, Run "chcp 437".Hm, I''ve tried playing around with it, but it doesn''t seem to change the language output of ping. However, that could very well have to do with the way this machine is configured. Heesob, does it work for you? I mean, do you have your console set to use Korean, but ping emits English for you if you do chcp 437 && ping -n1 www.ruby-lang.org? Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
Heesob Park
2008-Jan-18 16:00 UTC
[Win32utils-devel] Temporarily setting the output language forcmd.exe
Hi, 2008/1/19, Berger, Daniel <Daniel.Berger at qwest.com>:> > > -----Original Message----- > > From: win32utils-devel-bounces at rubyforge.org > > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of > > Heesob Park > > Sent: Thursday, January 17, 2008 9:03 PM > > To: Development and ideas for win32utils projects > > Subject: Re: [Win32utils-devel] Temporarily setting the > > output language forcmd.exe > > > > Hi, > > > > > > 2008/1/18, Daniel Berger <djberg96 at gmail.com >: > > > > Hi all, > > > > One of the net-ping users reported that the > > Net::Ping::External library > > was returning false positives on Vista. Basically, it > > does a ''ping -n1 > > host'' and checks for certain error strings. > > > > The problem is that the error strings it checks for are > > in English. The > > user in question is using a cmd.exe that''s entirely in > > Swedish (I think). > > > > Is there any way I can temporarily set the language of > > the command > > console so that it emits English only? I tried > > setlocale() but that > > didn''t work. Perhaps a registry setting somewhere? Or > > an explicit ''cmd > > /c'' call with some other special option? > > > > Thanks, > > > > Dan > > > > > > In the cmd.exe console window, Run "chcp 437". > > Hm, I''ve tried playing around with it, but it doesn''t seem to change the > language output of ping. However, that could very well have to do with > the way this machine is configured. > > Heesob, does it work for you? I mean, do you have your console set to > use Korean, but ping emits English for you if you do chcp 437 && ping > -n1 www.ruby-lang.org? > > Thanks, > > Dan > > > This communication is the property of Qwest and may contain confidential > or > privileged information. Unauthorized use of this communication is strictly > prohibited and may be unlawful. If you have received this communication > in error, please immediately notify the sender by reply e-mail and destroy > > all copies of the communication and any attachments. > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel >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 [221.186.184.68] with 32 bytes of data: Reply from 221.186.184.68: bytes=32 time=287ms TTL=39 Ping statistics for 221.186.184.68: Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 287ms, Maximum = 287ms, Average = 287ms Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080119/222a93c7/attachment-0001.html
Berger, Daniel
2008-Jan-18 17:49 UTC
[Win32utils-devel] Temporarily setting the output languageforcmd.exe
<snip>> 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 [221.186.184.68] with 32 bytes of data: > > Reply from 221.186.184.68: bytes=32 time=287ms TTL=39 > > Ping statistics for 221.186.184.68: > Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), > Approximate round trip times in milli-seconds: > Minimum = 287ms, Maximum = 287ms, Average = 287msAh, 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? Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
Daniel Berger
2008-Jan-19 01:27 UTC
[Win32utils-devel] Temporarily setting the output languageforcmd.exe
Berger, Daniel wrote:> <snip> > >> 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 [221.186.184.68] with 32 bytes of data: >> >> Reply from 221.186.184.68: bytes=32 time=287ms TTL=39 >> >> Ping statistics for 221.186.184.68: >> 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. Regards, Dan