$ cat foo.rb #!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'readline' s = Readline.readline '> ' p s.encoding p Readline.line_buffer.encoding $ ruby foo.rb > あ #<Encoding:UTF-8> #<Encoding:ASCII-8BIT> Readline.readlineはLocaleを元に文字コードを決めてる一方、Readline.line_bufferはとりあえずASCII-8BITにしてる模様。 ちなみにこれは、RubyコミッターでLinuxコミッターのkosakiさんとの対話が元ネタです。 追記2010-09-06 コメントいただいたように、kosakiさんの報告により、速攻で対応されました。ちゃんとテストも