Re: Hi character issue in IC5.0 - solution

"Chen Naor" <[email protected]> Sun, 11 Jan 2004 15:12:10 +0200
Newsgroups gmane.comp.web.interchange.internationalization
Organization Lilux Systems
Message-ID <[email protected]>
Chen Naor wrote:
> Hi all,
> 
> 
> 
> I found that in IC 5 there is a new lib that does the HTML encoding
> decoding: 
> 
> /usr/lib/interchange/lib/HTML/ Entities.pm (for RPM)
> 
> /usr/local/interchange/lib/HTML/ Entities.pm (for TAR)
> 
> Since the code is taken from HTML::Parser the change are similar (to
> enable hi characters). 
> 
> 
> 
> I do not know if this lib is take over the HTML encoding decoding
> from HTML::Parser or only part of it.
> 
> Mike? Racke?
> 
> 
> 
> If it does, then the patch to the HTML:Parser that I post before is
> no more relevant. 
> 
> Just use the new one.
> 
> 
> 
> If IC uses both then you need to patch both libs...
> 
> 
> 
> Attached is a small diff I made - it is done for Hebrew.
> 
Here is the attachment

_______________________________________________
interchange-i18n mailing list
[email protected]
http://www.icdevgroup.org/mailman/listinfo/interchange-i18n
Entities.pm.diff (application/octet-stream, 912 B)
--- Entities.pm.org	2004-01-11 13:05:08.000000000 +0200
+++ Entities.pm	2004-01-11 13:08:47.000000000 +0200
@@ -197,19 +197,19 @@
 
 sub encode_entities
 {
-    if (defined $_[1]) {
-	unless (exists $subst{$_[1]}) {
+#    if (defined $_[1]) {
+#	unless (exists $subst{$_[1]}) {
 	    # Because we can't compile regex we fake it with a cached sub
-	    $subst{$_[1]} =
-	      eval "sub {\$_[0] =~ s/([$_[1]])/\$char2entity{\$1}/g; }";
-	    die $@ if $@;
-	}
-	&{$subst{$_[1]}}($_[0]);
-    } else {
+#	    $subst{$_[1]} =
+#	      eval "sub {\$_[0] =~ s/([$_[1]])/\$char2entity{\$1}/g; }";
+#	    die $@ if $@;
+#	}
+#	&{$subst{$_[1]}}($_[0]);
+ #   } else {
 	# Encode control chars, high bit chars and '<', '&', '>', '"'
-	$_[0] =~ s/([^\n\t !\#\$%\'-;=?-~])/$char2entity{$1}/g;
-    }
-    $_[0];
+	$_[0] =~ s/([^\n\t !\#\$%\'-;=?-~\xe0-\xfb])/$char2entity{$1}/g;
+#    }
+     $_[0];
 }
 
 # Set up aliases