Method: MyMatrix.tosjis
- Defined in:
- lib/mymatrix.rb
.tosjis(str) ⇒ Object
Args
- str
-
UTF8文字列
Return
CP932の文字列
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/mymatrix.rb', line 61 def self.tosjis(str) if(RUBY_VERSION =~ /1\.[^9]/) #-xは半角カナを全角にするのを抑止するオプション。 out = NKF.nkf('-W -x -s --cp932', str) else str = MyMatrix.cp932ize(str) begin out = str.encode("Windows-31J") rescue => e p e p str out = str end end return out end |