Module: E4U::Encode::Encoding

Defined in:
lib/e4u/encode/encoding.rb

Class Method Summary collapse

Class Method Details

.to_cp932(str) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/e4u/encode/encoding.rb', line 15

def self.to_cp932 str
  puts "utf8_to_cp932" if $DEBUG
  if RUBY_VERSION < '1.9.1'
    NKF.nkf('-Wsm0x', str)
  else
    str.encode('CP932')
  end
end

.to_utf8(str) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/e4u/encode/encoding.rb', line 6

def self.to_utf8 str
  puts "cp932_to_utf8" if $DEBUG
  if RUBY_VERSION < '1.9.1'
    NKF.nkf('-Swm0x', str)
  else
    str.encode('UTF-8')
  end
end