2005-04-09 13:03:32 -04:00
|
|
|
module REXML
|
|
|
|
module Encoding
|
2005-12-09 09:31:47 -05:00
|
|
|
begin
|
|
|
|
require 'uconv'
|
|
|
|
|
|
|
|
def decode_eucjp(str)
|
|
|
|
Uconv::euctou8(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def encode_eucjp content
|
|
|
|
Uconv::u8toeuc(content)
|
|
|
|
end
|
|
|
|
rescue LoadError
|
|
|
|
require 'nkf'
|
|
|
|
|
|
|
|
EUCTOU8 = '-Ewm0'
|
|
|
|
U8TOEUC = '-Wem0'
|
2003-12-08 21:41:33 -05:00
|
|
|
|
2005-12-09 09:31:47 -05:00
|
|
|
def decode_eucjp(str)
|
|
|
|
NKF.nkf(EUCTOU8, str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def encode_eucjp content
|
|
|
|
NKF.nkf(U8TOEUC, content)
|
|
|
|
end
|
2005-04-09 13:03:32 -04:00
|
|
|
end
|
2003-07-09 18:28:42 -04:00
|
|
|
|
2005-04-09 13:03:32 -04:00
|
|
|
register("EUC-JP") do |obj|
|
|
|
|
class << obj
|
|
|
|
alias decode decode_eucjp
|
|
|
|
alias encode encode_eucjp
|
2003-12-08 21:41:33 -05:00
|
|
|
end
|
|
|
|
end
|
2003-07-09 18:28:42 -04:00
|
|
|
end
|
2003-06-09 21:31:01 -04:00
|
|
|
end
|