boboson has asked for the wisdom of the Perl Monks concerning the following question:
I am encoding the above string with the below code:http://domainname.com/homes/Test boende & Stöd- och rådgivningscenter
in IE7 I receive the following output:use Unicode::String qw(utf8 latin1); use URI::Escape; print "Content-type: text/html\n\n"; my @values = split('/', $ENV{PATH_INFO}); my $utf8 = Unicode::String->new( $values[1] ); print "utf8:".$utf8."<br />"; my $latin1 = Unicode::String::latin1($utf8); print "latin1:".$latin1."<br />"; # Works in IE my $unescapeIE = uri_unescape($latin1); print "unescapeIE:".$unescapeIE."<br />"; # works in FireFOx my $unescapeFF = uri_unescape($values[1]); print "unescapeFF:".$unescapeFF."<br />";
The third line is what I wantutf8:/Test boende & Stöd- och rÃ¥dgivningscenter latin1:/Test boende & Stöd- och rådgivningscenter unescapeIE:/Test boende & Stöd- och rådgivningscenter unescapeFF:/Test boende & Stöd- och rÃ¥dgivningscenter
The fourth line is what I wantutf8:/Test boende & Std- och rdgivningscenter latin1:/Test boende & Std- och rdgivningscenter unescapeIE:/Test boende & Std- och rdgivningscenter unescapeFF:/Test boende & Stöd- och rådgivningscenter
I receive the same output in both browsersmy $value = "Test boende & Stöd- och rådgivningscenter";
The fourth line will be correct in both IE7 and FF2, but I need to encode the string from the URL.utf8:Test boende & Std- och rdgivningscenter latin1:Test boende & Std- och rdgivningscenter unescapeIE:Test boende & Std- och rdgivningscenter unescapeFF:Test boende & Stöd- och rådgivningscenter
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uri_unescape differences in IE7 and FF2?
by f00li5h (Chaplain) on Apr 12, 2007 at 02:32 UTC | |
by boboson (Monk) on Apr 12, 2007 at 09:15 UTC |