This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Vista, ping and English
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
I got my first Vista related bug report this week. Specifically, the Net::Ping::External class (part of the net-ping library) has a bug where it was returning false positives.
The reason? For external pings I look for specific error messages like "host unreachable" or "100% packet loss". That works fine. So long as the output is in English. Which it always is. On Windows XP or earlier.
It turns out that the Windows Vista command shell returns the output of various commands in your native code page, not necessarily in English. So, if your command shell has its code page set to 860 (Portuguese), you would get "anfitriĆ£o unreachable" (or whatever it is) and the match would fail.
Normally, I wouldn't worry recommend external pings on MS Windows at all because you can use icmp pings. None of those pesky root permissions to worry about. Unfortunately, there's still that nasty bug where the socket.so that ships with the One Click Installer for Ruby is basically busted and causes Ruby to segfault. That really needs to be fixed and fast.