[interchange-i18n] Encoding decoding of non latin-1 language -Hebrew - Solved

Chen Naor chen at lilux.co.il
Wed Nov 19 01:19:24 UTC 2003



 > > 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 at shop2 HTML]# diff Entities.pm Entities.pm.org
 423,426c423,424
 < # changed by Guy Naor to enable Hebrew characters <chen at lilux.co.il>
 <
 < #    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
 
 
 





More information about the interchange-i18n mailing list