ex. $_table{'Ö'}; # gives 'Ö' #### my $bytes = pack( "C*", unpack( "U0C*", $$sgml_r )); #### use bytes; .... #all will happen wrapped here no bytes; #### $bytes =~ s/([^\ -\~]+.*)/$self->_fixup($1)/ego; #### $$sgml_r =~ s/(.)/$self->_mapchar($1)/eg; #### sub _mapchar { my ($char) = @_; if ( $char !~ /[\r\n\s]/) { my $nbytes = length encode_utf8($char); if ($nbytes > 1) { $char = exists $_table{$char} ? $_table{$char} : '?'; } } return $char; }