Project

General

Profile

Actions

Bug #3926

closed

Errno#message encoding is right ?

Added by arton (Akio Tajima) about 14 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-mswin32_100]
Backport:
[ruby-dev:42358]

Description

=begin
Errno::*#messageは、strerrで取ってきたメッセージなので、encodingは、localeに合わせたものを設定すべきと思うのですがどうでしょうか?

irb(main):001:0> Errno::EINVAL.new.message
=> "Invalid argument"
irb(main):002:0> Errno::EINVAL.new.message.encoding
=> #Encoding:ASCII-8BIT # ……まあ良いとして
irb(main):003:0> Errno::EWOULDBLOCK.new.message
=> "\x83u\x83\x8D\x83b\x83N\x95s\x89\xC2\x82\xCC\x83\\x83P\x83b\x83g\x91\x80\x8
D\xEC\x82\xF0\x82\xB7\x82\xAE\x82\xC9\x8A\xAE\x97\xB9\x82\xC5\x82\xAB\x82\xDC\x8
2\xB9\x82\xF1\x82\xC5\x82\xB5\x82\xBD\x81B"
irb(main):004:0> Errno::EWOULDBLOCK.new.message.encoding
=> #Encoding:ASCII-8BIT # …… CP932 であって欲しい
=end

Actions

Also available in: Atom PDF

Like0
Like0