File Coverage

blib/lib/ShiftJIS/CP932/Correct.pm
Criterion Covered Total %
statement 25 25 100.0
branch 4 4 100.0
condition n/a
subroutine 7 7 100.0
pod 3 3 100.0
total 39 39 100.0


line stmt bran cond sub pod time code
1             package ShiftJIS::CP932::Correct;
2              
3 2     2   1913 use strict;
  2         4  
  2         80  
4 2     2   10 use vars qw($VERSION $PACKAGE @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
  2         4  
  2         206  
5 2     2   10 use vars qw(%CorrCP932);
  2         6  
  2         68  
6 2     2   10 use Carp;
  2         4  
  2         10031  
7             require Exporter;
8             @ISA = qw(Exporter);
9             @EXPORT = qw(correct_cp932 is_corrected_cp932);
10             @EXPORT_OK = qw(correct_cp932 is_corrected_cp932 is_cp932);
11             %EXPORT_TAGS = (all => \@EXPORT_OK);
12              
13             $VERSION = '0.06';
14             $PACKAGE = 'ShiftJIS::CP932::Correct';
15              
16             my $Err_too = "$PACKAGE: Too many arguments for %s";
17              
18             my $Schar = '(?:[\x81-\x9F\xE0-\xFC][\x00-\xFF]|[\x00-\xFF])';
19              
20             my $CP932 = '(?:[\x00-\x7f\xa1-\xdf]|'
21             . '\x81[\x40-\x7e\x80-\xac\xb8-\xbf\xc8-\xce\xda-\xe8\xf0-\xf7\xfc]|'
22             . '\x82[\x4f-\x58\x60-\x79\x81-\x9a\x9f-\xf1]|'
23             . '\x83[\x40-\x7e\x80-\x96\x9f-\xb6\xbf-\xd6]|'
24             . '\x84[\x40-\x60\x70-\x7e\x80-\x91\x9f-\xbe]|'
25             . '\x88[\x9f-\xfc]|\x98[\x40-\x72\x9f-\xfc]|\xea[\x40-\x7e\x80-\xa4]|'
26             . '[\x89-\x97\x99-\x9f\xe0-\xe9][\x40-\x7e\x80-\xfc]|'
27             . '\x87[\x40-\x5d\x5f-\x75\x7e\x80-\x9c]|'
28             . '\xed[\x40-\x7e\x80-\xfc]|\xee[\x40-\x7e\x80-\xec\xef-\xfc]|'
29             . '[\xfa\xfb][\x40-\x7e\x80-\xfc]|\xfc[\x40-\x4b])';
30              
31             my $CorrectCP932 = '(?:[\x00-\x7f\xa1-\xdf]|'
32             . '\x81[\x40-\x7e\x80-\xac\xb8-\xbf\xc8-\xce\xda-\xe8\xf0-\xf7\xfc]|'
33             . '\x82[\x4f-\x58\x60-\x79\x81-\x9a\x9f-\xf1]|'
34             . '\x83[\x40-\x7e\x80-\x96\x9f-\xb6\xbf-\xd6]|'
35             . '\x84[\x40-\x60\x70-\x7e\x80-\x91\x9f-\xbe]|'
36             . '\x88[\x9f-\xfc]|\x98[\x40-\x72\x9f-\xfc]|\xea[\x40-\x7e\x80-\xa4]|'
37             . '[\x89-\x97\x99-\x9f\xe0-\xe9][\x40-\x7e\x80-\xfc]|'
38             . '\x87[\x40-\x5d\x5f-\x75\x7e\x80-\x8f\x93\x94\x98\x99]|'
39             . '\xfa[\x40-\x49\x55-\x57\x5c-\x7e\x80-\xfc]|'
40             . '\xfb[\x40-\x7e\x80-\xfc]|\xfc[\x40-\x4b])';
41              
42             %CorrCP932 = (
43             "\x87\x90" => "\x81\xe0",
44             "\x87\x91" => "\x81\xdf",
45             "\x87\x92" => "\x81\xe7",
46             "\x87\x95" => "\x81\xe3",
47             "\x87\x96" => "\x81\xdb",
48             "\x87\x97" => "\x81\xda",
49             "\x87\x9a" => "\x81\xe6",
50             "\x87\x9b" => "\x81\xbf",
51             "\x87\x9c" => "\x81\xbe",
52             "\xed\x40" => "\xfa\x5c",
53             "\xed\x41" => "\xfa\x5d",
54             "\xed\x42" => "\xfa\x5e",
55             "\xed\x43" => "\xfa\x5f",
56             "\xed\x44" => "\xfa\x60",
57             "\xed\x45" => "\xfa\x61",
58             "\xed\x46" => "\xfa\x62",
59             "\xed\x47" => "\xfa\x63",
60             "\xed\x48" => "\xfa\x64",
61             "\xed\x49" => "\xfa\x65",
62             "\xed\x4a" => "\xfa\x66",
63             "\xed\x4b" => "\xfa\x67",
64             "\xed\x4c" => "\xfa\x68",
65             "\xed\x4d" => "\xfa\x69",
66             "\xed\x4e" => "\xfa\x6a",
67             "\xed\x4f" => "\xfa\x6b",
68             "\xed\x50" => "\xfa\x6c",
69             "\xed\x51" => "\xfa\x6d",
70             "\xed\x52" => "\xfa\x6e",
71             "\xed\x53" => "\xfa\x6f",
72             "\xed\x54" => "\xfa\x70",
73             "\xed\x55" => "\xfa\x71",
74             "\xed\x56" => "\xfa\x72",
75             "\xed\x57" => "\xfa\x73",
76             "\xed\x58" => "\xfa\x74",
77             "\xed\x59" => "\xfa\x75",
78             "\xed\x5a" => "\xfa\x76",
79             "\xed\x5b" => "\xfa\x77",
80             "\xed\x5c" => "\xfa\x78",
81             "\xed\x5d" => "\xfa\x79",
82             "\xed\x5e" => "\xfa\x7a",
83             "\xed\x5f" => "\xfa\x7b",
84             "\xed\x60" => "\xfa\x7c",
85             "\xed\x61" => "\xfa\x7d",
86             "\xed\x62" => "\xfa\x7e",
87             "\xed\x63" => "\xfa\x80",
88             "\xed\x64" => "\xfa\x81",
89             "\xed\x65" => "\xfa\x82",
90             "\xed\x66" => "\xfa\x83",
91             "\xed\x67" => "\xfa\x84",
92             "\xed\x68" => "\xfa\x85",
93             "\xed\x69" => "\xfa\x86",
94             "\xed\x6a" => "\xfa\x87",
95             "\xed\x6b" => "\xfa\x88",
96             "\xed\x6c" => "\xfa\x89",
97             "\xed\x6d" => "\xfa\x8a",
98             "\xed\x6e" => "\xfa\x8b",
99             "\xed\x6f" => "\xfa\x8c",
100             "\xed\x70" => "\xfa\x8d",
101             "\xed\x71" => "\xfa\x8e",
102             "\xed\x72" => "\xfa\x8f",
103             "\xed\x73" => "\xfa\x90",
104             "\xed\x74" => "\xfa\x91",
105             "\xed\x75" => "\xfa\x92",
106             "\xed\x76" => "\xfa\x93",
107             "\xed\x77" => "\xfa\x94",
108             "\xed\x78" => "\xfa\x95",
109             "\xed\x79" => "\xfa\x96",
110             "\xed\x7a" => "\xfa\x97",
111             "\xed\x7b" => "\xfa\x98",
112             "\xed\x7c" => "\xfa\x99",
113             "\xed\x7d" => "\xfa\x9a",
114             "\xed\x7e" => "\xfa\x9b",
115             "\xed\x80" => "\xfa\x9c",
116             "\xed\x81" => "\xfa\x9d",
117             "\xed\x82" => "\xfa\x9e",
118             "\xed\x83" => "\xfa\x9f",
119             "\xed\x84" => "\xfa\xa0",
120             "\xed\x85" => "\xfa\xa1",
121             "\xed\x86" => "\xfa\xa2",
122             "\xed\x87" => "\xfa\xa3",
123             "\xed\x88" => "\xfa\xa4",
124             "\xed\x89" => "\xfa\xa5",
125             "\xed\x8a" => "\xfa\xa6",
126             "\xed\x8b" => "\xfa\xa7",
127             "\xed\x8c" => "\xfa\xa8",
128             "\xed\x8d" => "\xfa\xa9",
129             "\xed\x8e" => "\xfa\xaa",
130             "\xed\x8f" => "\xfa\xab",
131             "\xed\x90" => "\xfa\xac",
132             "\xed\x91" => "\xfa\xad",
133             "\xed\x92" => "\xfa\xae",
134             "\xed\x93" => "\xfa\xaf",
135             "\xed\x94" => "\xfa\xb0",
136             "\xed\x95" => "\xfa\xb1",
137             "\xed\x96" => "\xfa\xb2",
138             "\xed\x97" => "\xfa\xb3",
139             "\xed\x98" => "\xfa\xb4",
140             "\xed\x99" => "\xfa\xb5",
141             "\xed\x9a" => "\xfa\xb6",
142             "\xed\x9b" => "\xfa\xb7",
143             "\xed\x9c" => "\xfa\xb8",
144             "\xed\x9d" => "\xfa\xb9",
145             "\xed\x9e" => "\xfa\xba",
146             "\xed\x9f" => "\xfa\xbb",
147             "\xed\xa0" => "\xfa\xbc",
148             "\xed\xa1" => "\xfa\xbd",
149             "\xed\xa2" => "\xfa\xbe",
150             "\xed\xa3" => "\xfa\xbf",
151             "\xed\xa4" => "\xfa\xc0",
152             "\xed\xa5" => "\xfa\xc1",
153             "\xed\xa6" => "\xfa\xc2",
154             "\xed\xa7" => "\xfa\xc3",
155             "\xed\xa8" => "\xfa\xc4",
156             "\xed\xa9" => "\xfa\xc5",
157             "\xed\xaa" => "\xfa\xc6",
158             "\xed\xab" => "\xfa\xc7",
159             "\xed\xac" => "\xfa\xc8",
160             "\xed\xad" => "\xfa\xc9",
161             "\xed\xae" => "\xfa\xca",
162             "\xed\xaf" => "\xfa\xcb",
163             "\xed\xb0" => "\xfa\xcc",
164             "\xed\xb1" => "\xfa\xcd",
165             "\xed\xb2" => "\xfa\xce",
166             "\xed\xb3" => "\xfa\xcf",
167             "\xed\xb4" => "\xfa\xd0",
168             "\xed\xb5" => "\xfa\xd1",
169             "\xed\xb6" => "\xfa\xd2",
170             "\xed\xb7" => "\xfa\xd3",
171             "\xed\xb8" => "\xfa\xd4",
172             "\xed\xb9" => "\xfa\xd5",
173             "\xed\xba" => "\xfa\xd6",
174             "\xed\xbb" => "\xfa\xd7",
175             "\xed\xbc" => "\xfa\xd8",
176             "\xed\xbd" => "\xfa\xd9",
177             "\xed\xbe" => "\xfa\xda",
178             "\xed\xbf" => "\xfa\xdb",
179             "\xed\xc0" => "\xfa\xdc",
180             "\xed\xc1" => "\xfa\xdd",
181             "\xed\xc2" => "\xfa\xde",
182             "\xed\xc3" => "\xfa\xdf",
183             "\xed\xc4" => "\xfa\xe0",
184             "\xed\xc5" => "\xfa\xe1",
185             "\xed\xc6" => "\xfa\xe2",
186             "\xed\xc7" => "\xfa\xe3",
187             "\xed\xc8" => "\xfa\xe4",
188             "\xed\xc9" => "\xfa\xe5",
189             "\xed\xca" => "\xfa\xe6",
190             "\xed\xcb" => "\xfa\xe7",
191             "\xed\xcc" => "\xfa\xe8",
192             "\xed\xcd" => "\xfa\xe9",
193             "\xed\xce" => "\xfa\xea",
194             "\xed\xcf" => "\xfa\xeb",
195             "\xed\xd0" => "\xfa\xec",
196             "\xed\xd1" => "\xfa\xed",
197             "\xed\xd2" => "\xfa\xee",
198             "\xed\xd3" => "\xfa\xef",
199             "\xed\xd4" => "\xfa\xf0",
200             "\xed\xd5" => "\xfa\xf1",
201             "\xed\xd6" => "\xfa\xf2",
202             "\xed\xd7" => "\xfa\xf3",
203             "\xed\xd8" => "\xfa\xf4",
204             "\xed\xd9" => "\xfa\xf5",
205             "\xed\xda" => "\xfa\xf6",
206             "\xed\xdb" => "\xfa\xf7",
207             "\xed\xdc" => "\xfa\xf8",
208             "\xed\xdd" => "\xfa\xf9",
209             "\xed\xde" => "\xfa\xfa",
210             "\xed\xdf" => "\xfa\xfb",
211             "\xed\xe0" => "\xfa\xfc",
212             "\xed\xe1" => "\xfb\x40",
213             "\xed\xe2" => "\xfb\x41",
214             "\xed\xe3" => "\xfb\x42",
215             "\xed\xe4" => "\xfb\x43",
216             "\xed\xe5" => "\xfb\x44",
217             "\xed\xe6" => "\xfb\x45",
218             "\xed\xe7" => "\xfb\x46",
219             "\xed\xe8" => "\xfb\x47",
220             "\xed\xe9" => "\xfb\x48",
221             "\xed\xea" => "\xfb\x49",
222             "\xed\xeb" => "\xfb\x4a",
223             "\xed\xec" => "\xfb\x4b",
224             "\xed\xed" => "\xfb\x4c",
225             "\xed\xee" => "\xfb\x4d",
226             "\xed\xef" => "\xfb\x4e",
227             "\xed\xf0" => "\xfb\x4f",
228             "\xed\xf1" => "\xfb\x50",
229             "\xed\xf2" => "\xfb\x51",
230             "\xed\xf3" => "\xfb\x52",
231             "\xed\xf4" => "\xfb\x53",
232             "\xed\xf5" => "\xfb\x54",
233             "\xed\xf6" => "\xfb\x55",
234             "\xed\xf7" => "\xfb\x56",
235             "\xed\xf8" => "\xfb\x57",
236             "\xed\xf9" => "\xfb\x58",
237             "\xed\xfa" => "\xfb\x59",
238             "\xed\xfb" => "\xfb\x5a",
239             "\xed\xfc" => "\xfb\x5b",
240             "\xee\x40" => "\xfb\x5c",
241             "\xee\x41" => "\xfb\x5d",
242             "\xee\x42" => "\xfb\x5e",
243             "\xee\x43" => "\xfb\x5f",
244             "\xee\x44" => "\xfb\x60",
245             "\xee\x45" => "\xfb\x61",
246             "\xee\x46" => "\xfb\x62",
247             "\xee\x47" => "\xfb\x63",
248             "\xee\x48" => "\xfb\x64",
249             "\xee\x49" => "\xfb\x65",
250             "\xee\x4a" => "\xfb\x66",
251             "\xee\x4b" => "\xfb\x67",
252             "\xee\x4c" => "\xfb\x68",
253             "\xee\x4d" => "\xfb\x69",
254             "\xee\x4e" => "\xfb\x6a",
255             "\xee\x4f" => "\xfb\x6b",
256             "\xee\x50" => "\xfb\x6c",
257             "\xee\x51" => "\xfb\x6d",
258             "\xee\x52" => "\xfb\x6e",
259             "\xee\x53" => "\xfb\x6f",
260             "\xee\x54" => "\xfb\x70",
261             "\xee\x55" => "\xfb\x71",
262             "\xee\x56" => "\xfb\x72",
263             "\xee\x57" => "\xfb\x73",
264             "\xee\x58" => "\xfb\x74",
265             "\xee\x59" => "\xfb\x75",
266             "\xee\x5a" => "\xfb\x76",
267             "\xee\x5b" => "\xfb\x77",
268             "\xee\x5c" => "\xfb\x78",
269             "\xee\x5d" => "\xfb\x79",
270             "\xee\x5e" => "\xfb\x7a",
271             "\xee\x5f" => "\xfb\x7b",
272             "\xee\x60" => "\xfb\x7c",
273             "\xee\x61" => "\xfb\x7d",
274             "\xee\x62" => "\xfb\x7e",
275             "\xee\x63" => "\xfb\x80",
276             "\xee\x64" => "\xfb\x81",
277             "\xee\x65" => "\xfb\x82",
278             "\xee\x66" => "\xfb\x83",
279             "\xee\x67" => "\xfb\x84",
280             "\xee\x68" => "\xfb\x85",
281             "\xee\x69" => "\xfb\x86",
282             "\xee\x6a" => "\xfb\x87",
283             "\xee\x6b" => "\xfb\x88",
284             "\xee\x6c" => "\xfb\x89",
285             "\xee\x6d" => "\xfb\x8a",
286             "\xee\x6e" => "\xfb\x8b",
287             "\xee\x6f" => "\xfb\x8c",
288             "\xee\x70" => "\xfb\x8d",
289             "\xee\x71" => "\xfb\x8e",
290             "\xee\x72" => "\xfb\x8f",
291             "\xee\x73" => "\xfb\x90",
292             "\xee\x74" => "\xfb\x91",
293             "\xee\x75" => "\xfb\x92",
294             "\xee\x76" => "\xfb\x93",
295             "\xee\x77" => "\xfb\x94",
296             "\xee\x78" => "\xfb\x95",
297             "\xee\x79" => "\xfb\x96",
298             "\xee\x7a" => "\xfb\x97",
299             "\xee\x7b" => "\xfb\x98",
300             "\xee\x7c" => "\xfb\x99",
301             "\xee\x7d" => "\xfb\x9a",
302             "\xee\x7e" => "\xfb\x9b",
303             "\xee\x80" => "\xfb\x9c",
304             "\xee\x81" => "\xfb\x9d",
305             "\xee\x82" => "\xfb\x9e",
306             "\xee\x83" => "\xfb\x9f",
307             "\xee\x84" => "\xfb\xa0",
308             "\xee\x85" => "\xfb\xa1",
309             "\xee\x86" => "\xfb\xa2",
310             "\xee\x87" => "\xfb\xa3",
311             "\xee\x88" => "\xfb\xa4",
312             "\xee\x89" => "\xfb\xa5",
313             "\xee\x8a" => "\xfb\xa6",
314             "\xee\x8b" => "\xfb\xa7",
315             "\xee\x8c" => "\xfb\xa8",
316             "\xee\x8d" => "\xfb\xa9",
317             "\xee\x8e" => "\xfb\xaa",
318             "\xee\x8f" => "\xfb\xab",
319             "\xee\x90" => "\xfb\xac",
320             "\xee\x91" => "\xfb\xad",
321             "\xee\x92" => "\xfb\xae",
322             "\xee\x93" => "\xfb\xaf",
323             "\xee\x94" => "\xfb\xb0",
324             "\xee\x95" => "\xfb\xb1",
325             "\xee\x96" => "\xfb\xb2",
326             "\xee\x97" => "\xfb\xb3",
327             "\xee\x98" => "\xfb\xb4",
328             "\xee\x99" => "\xfb\xb5",
329             "\xee\x9a" => "\xfb\xb6",
330             "\xee\x9b" => "\xfb\xb7",
331             "\xee\x9c" => "\xfb\xb8",
332             "\xee\x9d" => "\xfb\xb9",
333             "\xee\x9e" => "\xfb\xba",
334             "\xee\x9f" => "\xfb\xbb",
335             "\xee\xa0" => "\xfb\xbc",
336             "\xee\xa1" => "\xfb\xbd",
337             "\xee\xa2" => "\xfb\xbe",
338             "\xee\xa3" => "\xfb\xbf",
339             "\xee\xa4" => "\xfb\xc0",
340             "\xee\xa5" => "\xfb\xc1",
341             "\xee\xa6" => "\xfb\xc2",
342             "\xee\xa7" => "\xfb\xc3",
343             "\xee\xa8" => "\xfb\xc4",
344             "\xee\xa9" => "\xfb\xc5",
345             "\xee\xaa" => "\xfb\xc6",
346             "\xee\xab" => "\xfb\xc7",
347             "\xee\xac" => "\xfb\xc8",
348             "\xee\xad" => "\xfb\xc9",
349             "\xee\xae" => "\xfb\xca",
350             "\xee\xaf" => "\xfb\xcb",
351             "\xee\xb0" => "\xfb\xcc",
352             "\xee\xb1" => "\xfb\xcd",
353             "\xee\xb2" => "\xfb\xce",
354             "\xee\xb3" => "\xfb\xcf",
355             "\xee\xb4" => "\xfb\xd0",
356             "\xee\xb5" => "\xfb\xd1",
357             "\xee\xb6" => "\xfb\xd2",
358             "\xee\xb7" => "\xfb\xd3",
359             "\xee\xb8" => "\xfb\xd4",
360             "\xee\xb9" => "\xfb\xd5",
361             "\xee\xba" => "\xfb\xd6",
362             "\xee\xbb" => "\xfb\xd7",
363             "\xee\xbc" => "\xfb\xd8",
364             "\xee\xbd" => "\xfb\xd9",
365             "\xee\xbe" => "\xfb\xda",
366             "\xee\xbf" => "\xfb\xdb",
367             "\xee\xc0" => "\xfb\xdc",
368             "\xee\xc1" => "\xfb\xdd",
369             "\xee\xc2" => "\xfb\xde",
370             "\xee\xc3" => "\xfb\xdf",
371             "\xee\xc4" => "\xfb\xe0",
372             "\xee\xc5" => "\xfb\xe1",
373             "\xee\xc6" => "\xfb\xe2",
374             "\xee\xc7" => "\xfb\xe3",
375             "\xee\xc8" => "\xfb\xe4",
376             "\xee\xc9" => "\xfb\xe5",
377             "\xee\xca" => "\xfb\xe6",
378             "\xee\xcb" => "\xfb\xe7",
379             "\xee\xcc" => "\xfb\xe8",
380             "\xee\xcd" => "\xfb\xe9",
381             "\xee\xce" => "\xfb\xea",
382             "\xee\xcf" => "\xfb\xeb",
383             "\xee\xd0" => "\xfb\xec",
384             "\xee\xd1" => "\xfb\xed",
385             "\xee\xd2" => "\xfb\xee",
386             "\xee\xd3" => "\xfb\xef",
387             "\xee\xd4" => "\xfb\xf0",
388             "\xee\xd5" => "\xfb\xf1",
389             "\xee\xd6" => "\xfb\xf2",
390             "\xee\xd7" => "\xfb\xf3",
391             "\xee\xd8" => "\xfb\xf4",
392             "\xee\xd9" => "\xfb\xf5",
393             "\xee\xda" => "\xfb\xf6",
394             "\xee\xdb" => "\xfb\xf7",
395             "\xee\xdc" => "\xfb\xf8",
396             "\xee\xdd" => "\xfb\xf9",
397             "\xee\xde" => "\xfb\xfa",
398             "\xee\xdf" => "\xfb\xfb",
399             "\xee\xe0" => "\xfb\xfc",
400             "\xee\xe1" => "\xfc\x40",
401             "\xee\xe2" => "\xfc\x41",
402             "\xee\xe3" => "\xfc\x42",
403             "\xee\xe4" => "\xfc\x43",
404             "\xee\xe5" => "\xfc\x44",
405             "\xee\xe6" => "\xfc\x45",
406             "\xee\xe7" => "\xfc\x46",
407             "\xee\xe8" => "\xfc\x47",
408             "\xee\xe9" => "\xfc\x48",
409             "\xee\xea" => "\xfc\x49",
410             "\xee\xeb" => "\xfc\x4a",
411             "\xee\xec" => "\xfc\x4b",
412             "\xee\xef" => "\xfa\x40",
413             "\xee\xf0" => "\xfa\x41",
414             "\xee\xf1" => "\xfa\x42",
415             "\xee\xf2" => "\xfa\x43",
416             "\xee\xf3" => "\xfa\x44",
417             "\xee\xf4" => "\xfa\x45",
418             "\xee\xf5" => "\xfa\x46",
419             "\xee\xf6" => "\xfa\x47",
420             "\xee\xf7" => "\xfa\x48",
421             "\xee\xf8" => "\xfa\x49",
422             "\xee\xf9" => "\x81\xca",
423             "\xee\xfa" => "\xfa\x55",
424             "\xee\xfb" => "\xfa\x56",
425             "\xee\xfc" => "\xfa\x57",
426             "\xfa\x4a" => "\x87\x54",
427             "\xfa\x4b" => "\x87\x55",
428             "\xfa\x4c" => "\x87\x56",
429             "\xfa\x4d" => "\x87\x57",
430             "\xfa\x4e" => "\x87\x58",
431             "\xfa\x4f" => "\x87\x59",
432             "\xfa\x50" => "\x87\x5a",
433             "\xfa\x51" => "\x87\x5b",
434             "\xfa\x52" => "\x87\x5c",
435             "\xfa\x53" => "\x87\x5d",
436             "\xfa\x54" => "\x81\xca",
437             "\xfa\x58" => "\x87\x8a",
438             "\xfa\x59" => "\x87\x82",
439             "\xfa\x5a" => "\x87\x84",
440             "\xfa\x5b" => "\x81\xe6",
441             );
442              
443             sub correct_cp932 ($) {
444 15638     15638 1 44209 my $result = "";
445 15638         19227 my $str = shift;
446 15638         55697 while ($str =~ /\G($Schar)/go) {
447 15670         30831 my $c = $1;
448 15670 100       73170 next unless $c =~ m|^$CP932$|o;
449 7964 100       33324 $result .= defined $CorrCP932{ $c } ? $CorrCP932{ $c } : $c;
450             }
451 15638         39295 return $result;
452             }
453              
454             sub is_corrected_cp932 ($) {
455 15617     15617 1 40775 my $str = shift;
456 15617         69681 $str =~ s/\G$CorrectCP932//g;
457 15617         40637 ! length $str;
458             }
459              
460             sub is_cp932 ($) {
461 15616     15616 1 126373 my $str = shift;
462 15616         70550 $str =~ s/\G$CP932//g;
463 15616         37041 ! length $str;
464             }
465              
466             1;
467             __END__