240 |
default => -1, |
default => -1, |
241 |
}, |
}, |
242 |
}, |
}, |
243 |
|
fallback_from_ucs => 'replacement', |
244 |
|
## 'replacement' / 'perl' / 'sgml' / 'sgml-hex' / 'x-u-escaped' / 'code' |
245 |
|
## / 'quiet' / 'quiet+back' / 'quiet+warn' / 'quiet+back+warn' / 'croak' |
246 |
|
## / code |
247 |
final_to_set => { |
final_to_set => { |
248 |
C0 => {}, C1 => {}, G94 => {}, G94n => {}, |
C0 => {}, C1 => {}, G94 => {}, G94n => {}, |
249 |
G96 => {}, G96n => {}, coding_system => {}, |
G96 => {}, G96n => {}, coding_system => {}, |
266 |
Gdesignation => "\x42", ## F of designation or 0 |
Gdesignation => "\x42", ## F of designation or 0 |
267 |
Ginvoke => 1, |
Ginvoke => 1, |
268 |
}, |
}, |
269 |
|
reset_at_end => {}, ## Default: same as 'reset''s value |
270 |
undef_char => ["\x3F", {type => 'G94', charset => 'B'}], |
undef_char => ["\x3F", {type => 'G94', charset => 'B'}], |
271 |
use_revision => 1, ## Output IRR |
use_revision => 1, ## Output IRR |
272 |
}; |
}; |
289 |
$C; |
$C; |
290 |
} |
} |
291 |
|
|
292 |
1; |
our %FallbackFromUCS = ( |
293 |
__END__ |
perl => sub { my $c = $_[2]; sprintf '\x{%04X}', ord $c }, |
294 |
|
sgml => sub { my $c = $_[2]; sprintf '&#%d;', ord $c }, |
295 |
|
'sgml-hex' => sub { my $c = $_[2]; sprintf '&#x%04X;', ord $c }, |
296 |
|
'x-u-escaped' => sub { my $c = $_[2]; my $C = ord $c; sprintf $C > 0xFFFF ? '\U%08X' : '\u%04X', $C }, |
297 |
|
); |
298 |
|
|
299 |
|
sub fallback_escape ($$$;%) { |
300 |
|
my (undef, $C, $c, %option) = @_; |
301 |
|
my $f = $option{fallback_from_ucs} ? |
302 |
|
(ref ($option{fallback_from_ucs}) eq 'CODE' ? $option{fallback_from_ucs} : |
303 |
|
$FallbackFromUCS{$option{fallback_from_ucs}}): |
304 |
|
(ref ($C->{option}->{fallback_from_ucs}) eq 'CODE' ? $C->{option}->{fallback_from_ucs} : |
305 |
|
$FallbackFromUCS{$C->{option}->{fallback_from_ucs}}); |
306 |
|
if (ref $f) { |
307 |
|
return undef if $option{_recursive} <= -10; $option{_recursive}--; ## To avoid loop |
308 |
|
my $self = bless {}, __PACKAGE__; |
309 |
|
Encode::_utf8_on ($c); |
310 |
|
return &$f ($self, $C, $c, \%option); |
311 |
|
} |
312 |
|
undef; |
313 |
|
} |
314 |
|
|
315 |
=head1 AUTHORS |
=head1 AUTHORS |
316 |
|
|
317 |
Nanashi-san |
Nanashi-san <nanashi-san@nanashi.invalid> |
318 |
|
|
319 |
Wakaba <w@suika.fam.cx> |
Wakaba <w@suika.fam.cx> |
320 |
|
|
321 |
=head1 LICENSE |
=head1 LICENSE |
322 |
|
|
323 |
Copyright 2002 AUTHORS |
Copyright 2002 AUTHORS, all rights reserved. |
324 |
|
|
325 |
This library is free software; you can redistribute it |
This library is free software; you can redistribute it |
326 |
and/or modify it under the same terms as Perl itself. |
and/or modify it under the same terms as Perl itself. |
327 |
|
|
328 |
=cut |
=cut |
329 |
|
|
330 |
# $Date$ |
1; # $Date$ |
|
### Charset.pm ends here |
|