re: Encoding decoding of non latin-1 language -Hebrew - Solved
"Chen Naor" <[email protected]> Wed, 19 Nov 2003 03:19:24 +0200
| Newsgroups | gmane.comp.web.interchange.internationalization |
|---|---|
| Organization | Lilux Systems |
| Message-ID | <[email protected]> |
> > Note: the patch is disabling some of the Html:Entities functionality. > > > > If someone need the patch please contact me here. > > Would you mind to send me this patch ? > > Ciao > Racke Hi , I will send the package to you directly since it a bit to big for the mailing list. Change made only in : HTML-Parser-3.33/lib/HTML/Entities.pm Original file is: HTML-Parser-3.33/lib/HTML/Entities.pm.org Look at the rems from line 423 - 438 Here is the diff: [chen@shop2 HTML]# diff Entities.pm Entities.pm.org 423,426c423,424 < # changed by Guy Naor to enable Hebrew characters <[email protected]> < < # if (defined $_[1] and length $_[1]) { < # unless (exists $subst{$_[1]}) { --- > if (defined $_[1] and length $_[1]) { > unless (exists $subst{$_[1]}) { 428,438c426,436 < # my $code = "sub {\$_[0] =~ s/([$_[1]])/\$char2entity{\$1} || num_entity(\$1)/ge; }"; < # $subst{$_[1]} = eval $code; < # die( $@ . " while trying to turn range: \"$_[1]\"\n " < # . "into code: $code\n " < # ) if $@; < # } < # &{$subst{$_[1]}}($$ref); < # } else { < # # Encode control chars, high bit chars and '<', '&', '>', '"' < $$ref =~ s/([^\n\r\t !\#\$%\'-;=?-~\xe0-\xfb])/$char2entity{$1} || num_entity($1)/ge; < # } --- > my $code = "sub {\$_[0] =~ s/([$_[1]])/\$char2entity{\$1} || num_entity(\$1)/ge; }"; > $subst{$_[1]} = eval $code; > die( $@ . " while trying to turn range: \"$_[1]\"\n " > . "into code: $code\n " > ) if $@; > } > &{$subst{$_[1]}}($$ref); > } else { > # Encode control chars, high bit chars and '<', '&', '>', '"' > $$ref =~ s/([^\n\r\t !\#\$%\'-;=?-~])/$char2entity{$1} || num_entity($1)/ge; > } Good luck & good night (3:00 AM) Chen