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 |
}; |
}; |
290 |
} |
} |
291 |
|
|
292 |
our %FallbackFromUCS = ( |
our %FallbackFromUCS = ( |
293 |
perl => sub { my $c = $_[1]; sprintf '\x{%04X}', ord $c }, |
perl => sub { my $c = $_[2]; sprintf '\x{%04X}', ord $c }, |
294 |
sgml => sub { my $c = $_[1]; sprintf '&#%d;', ord $c }, |
sgml => sub { my $c = $_[2]; sprintf '&#%d;', ord $c }, |
295 |
'sgml-hex' => sub { my $c = $_[1]; sprintf '&#x%04X;', ord $c }, |
'sgml-hex' => sub { my $c = $_[2]; sprintf '&#x%04X;', ord $c }, |
296 |
'x-u-escaped' => sub { my $c = $_[1]; my $C = ord $c; sprintf $C > 0xFFFF ? '\U%08X' : '\u%04X', $C }, |
'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 ($$;%) { |
sub fallback_escape ($$$;%) { |
300 |
my ($C, $c, %option) = @_; |
my (undef, $C, $c, %option) = @_; |
301 |
my $f = ref ($C->{option}->{fallback_from_ucs}) eq 'CODE' ? $C->{option}->{fallback_from_ucs} : |
my $f = $option{fallback_from_ucs} ? |
302 |
$FallbackFromUCS{$C->{option}->{fallback_from_ucs}}; |
(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) { |
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); |
Encode::_utf8_on ($c); |
310 |
return &$f ($C, $c, %option); |
return &$f ($self, $C, $c, \%option); |
311 |
} |
} |
312 |
undef; |
undef; |
313 |
} |
} |