source: extensions/gsdl-video/trunk/installed/cmdline/lib/ruby/1.8/rexml/encodings/SHIFT-JIS.rb@ 18425

Last change on this file since 18425 was 18425, checked in by davidb, 15 years ago

Video extension to Greenstone

File size: 645 bytes
RevLine 
[18425]1module REXML
2 module Encoding
3 begin
4 require 'uconv'
5
6 def decode_sjis content
7 Uconv::sjistou8(content)
8 end
9
10 def encode_sjis(str)
11 Uconv::u8tosjis(str)
12 end
13 rescue LoadError
14 require 'nkf'
15
16 SJISTOU8 = '-Swm0'
17 U8TOSJIS = '-Wsm0'
18
19 def decode_sjis(str)
20 NKF.nkf(SJISTOU8, str)
21 end
22
23 def encode_sjis content
24 NKF.nkf(U8TOSJIS, content)
25 end
26 end
27
28 b = proc do |obj|
29 class << obj
30 alias decode decode_sjis
31 alias encode encode_sjis
32 end
33 end
34 register("SHIFT-JIS", &b)
35 register("SHIFT_JIS", &b)
36 end
37end
Note: See TracBrowser for help on using the repository browser.