2003-06-10 01:31:01 +00: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 22:28:42 +00:00
|
|
|
begin
|
|
|
|
require 'iconv'
|
|
|
|
module REXML
|
|
|
|
module Encoding
|
|
|
|
def from_euc_jp(str)
|
2003-07-17 05:23:54 +00:00
|
|
|
return Iconv::iconv("utf-8", "euc-jp", str).join('')
|
2003-07-09 22:28:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_euc_jp content
|
2003-07-17 05:23:54 +00:00
|
|
|
return Iconv::iconv("euc-jp", "utf-8", content).join('')
|
2003-07-09 22:28:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
rescue LoadError
|
|
|
|
raise "uconv or iconv is required for Japanese encoding support."
|
|
|
|
end
|
2003-06-10 01:31:01 +00:00
|
|
|
end
|