2005-04-09 13:03:32 -04:00
|
|
|
require 'uconv'
|
2003-12-12 16:17:41 -05:00
|
|
|
|
2005-04-09 13:03:32 -04:00
|
|
|
module REXML
|
|
|
|
module Encoding
|
|
|
|
def decode_sjis content
|
2005-04-25 01:09:08 -04:00
|
|
|
Uconv::sjistou8(content)
|
2003-12-12 16:17:41 -05:00
|
|
|
end
|
|
|
|
|
2005-04-09 13:03:32 -04:00
|
|
|
def encode_sjis(str)
|
2005-04-25 01:09:08 -04:00
|
|
|
Uconv::u8tosjis(str)
|
2005-04-09 13:03:32 -04:00
|
|
|
end
|
2003-12-12 16:17:41 -05:00
|
|
|
|
2005-04-09 13:03:32 -04:00
|
|
|
b = proc do |obj|
|
|
|
|
class << obj
|
|
|
|
alias decode decode_sjis
|
|
|
|
alias encode encode_sjis
|
2003-12-12 16:17:41 -05:00
|
|
|
end
|
|
|
|
end
|
2005-04-09 13:03:32 -04:00
|
|
|
register("SHIFT-JIS", &b)
|
|
|
|
register("SHIFT_JIS", &b)
|
2003-12-12 16:17:41 -05:00
|
|
|
end
|
|
|
|
end
|