Method: MyMatrix.toutf8

Defined in:
lib/mymatrix.rb

.toutf8(str) ⇒ Object

外部ファイルエンコード(CP932)を内部エンコード(UTF8)に変換する

Args

str

CP932 string

Return

UTF8 String



82
83
84
85
86
87
88
89
90
# File 'lib/mymatrix.rb', line 82

def self.toutf8(str)
   if(RUBY_VERSION =~ /1\.[^9]/)
     #入力がShift-jisであるとする。
     out = NKF.nkf('-S -x -w --cp932', str)
   else
     out = str.encode('UTF-8')
   end
  return out   
end