2003-06-09 21:31:01 -04:00
|
|
|
begin
|
|
|
|
require 'uconv'
|
|
|
|
|
|
|
|
module REXML
|
|
|
|
module Encoding
|
|
|
|
def from_euc_jp(str)
|
|
|
|
return Uconv::euctou8(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_euc_jp content
|
|
|
|
return Uconv::u8toeuc(content)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
rescue LoadError
|
2003-07-09 18:28:42 -04:00
|
|
|
begin
|
|
|
|
require 'iconv'
|
|
|
|
module REXML
|
|
|
|
module Encoding
|
|
|
|
def from_euc_jp(str)
|
2003-07-17 01:23:54 -04:00
|
|
|
return Iconv::iconv("utf-8", "euc-jp", str).join('')
|
2003-07-09 18:28:42 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_euc_jp content
|
2003-07-17 01:23:54 -04:00
|
|
|
return Iconv::iconv("euc-jp", "utf-8", content).join('')
|
2003-07-09 18:28:42 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
rescue LoadError
|
|
|
|
raise "uconv or iconv is required for Japanese encoding support."
|
|
|
|
end
|
2003-06-09 21:31:01 -04:00
|
|
|
end
|