xmlparser 0.6.81 → 0.7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,42 +0,0 @@
1
- ## -*- Ruby -*-
2
- ## Sample XMLEncoding class for Japanese (EUC-JP, Shift_JIS)
3
- ## 1998 by yoshidam
4
- ##
5
- ## Usage:
6
- ## require 'xml/encoding-ja'
7
- ## include XML::Encoding_ja
8
-
9
- module XML
10
- module Encoding_ja
11
- require 'xml/parser'
12
- require 'uconv'
13
-
14
- class EUCHandler<XML::Encoding
15
- def map(i)
16
- return i if i < 128
17
- return -1 if i < 160 or i == 255
18
- return -2
19
- end
20
- def convert(s)
21
- Uconv.euctou2(s)
22
- end
23
- end
24
-
25
- class SJISHandler<XML::Encoding
26
- def map(i)
27
- return i if i < 128
28
- return -2
29
- end
30
- def convert(s)
31
- Uconv.sjistou2(s)
32
- end
33
- end
34
-
35
- def unknownEncoding(name)
36
- return EUCHandler.new if name =~ /^euc-jp$/i
37
- return SJISHandler.new if name =~ /^shift_jis$/i
38
- nil
39
- end
40
-
41
- end
42
- end