Hi Dan,
The patch got wordwrapped by your mailer, and although I think I
unword-wrapped it right, the patch still failed. Do you mind adding the
patch as a MIME attachment?
Lincoln
On Friday 11 April 2003 01:48 am, Dan Kogai wrote:
% diff -ruN CGI.pm-2.88 CGI.pm-2.88.dan
diff -ruN CGI.pm-2.88/CGI/Util.pm CGI.pm-2.88.dan/CGI/Util.pm
--- CGI.pm-2.88/CGI/Util.pm Mon Dec 10 06:37:06 2001
+++ CGI.pm-2.88.dan/CGI/Util.pm Fri Apr 11 14:36:42 2003
@@ -199,6 +199,8 @@
shift() if @_ > 1 and ( ref($_[0]) || (defined $_[1] && $_[0] eq
$CGI::DefaultClass));
my $toencode = shift;
return undef unless defined($toencode);
+ # force bytes while preserving backward compatibility -- dankogai
+ $toencode = pack("C*", unpack("C*", $toencode));
if ($EBCDIC) {
$toencode=~s/([^a-zA-Z0-9_.-])/uc
sprintf("%%%02x",$E2A[ord($1)])/eg;
} else {
diff -ruN CGI.pm-2.88/MANIFEST CGI.pm-2.88.dan/MANIFEST
--- CGI.pm-2.88/MANIFEST Mon Dec 10 06:37:06 2001
+++ CGI.pm-2.88.dan/MANIFEST Fri Apr 11 14:39:44 2003
@@ -50,3 +50,4 @@
t/request.t
t/switch.t
t/util.t
+t/util-58.t
diff -ruN CGI.pm-2.88/t/util-58.t CGI.pm-2.88.dan/t/util-58.t
--- CGI.pm-2.88/t/util-58.t Thu Jan 1 09:00:00 1970
+++ CGI.pm-2.88.dan/t/util-58.t Fri Apr 11 14:46:45 2003
@@ -0,0 +1,16 @@
+#
+# This tests CGI::Util::escape() when fed with UTF-8-flagged string
+# -- dankogai
+BEGIN {
+ if ($] < 5.008) {
+ print "1..0 # \$] == $] < 5.008\n";
+ exit(0);
+ }
+}
+
+use Test::More tests => 2;
+use_ok("CGI::Util");
+my $uri = "\x{5c0f}\x{98fc} \x{5f3e}.txt"; # KOGAI, Dan, in Kanji
+is(CGI::Util::escape($uri), "%E5%B0%8F%E9%A3%BC%20%E5%BC%BE.txt",
+ "# Escape string with UTF-8 flag");
+__END__
--
========================================================================
Lincoln D. Stein Cold Spring Harbor Laboratory
lstein(_at_)cshl(_dot_)org Cold Spring
Harbor, NY
========================================================================