I am trying to get IE7 and FireFox 2 to output the same result when encoding the PATH_INFO environment variable. The URL will look something like:
http://domainname.com/homes/Test boende & Stöd- och rådgivningscenter
I am encoding the above string with the below code:
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 />";
in IE7 I receive the following output:
utf8:/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 third line is what I want
in FF2 I receive the following output:
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
The fourth line is what I want
If I put the string directly in a variable:
my $value = "Test boende & Stöd- och rådgivningscenter";
I receive the same output in both browsers
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
The fourth line will be correct in both IE7 and FF2, but I need to encode the string from the URL.
Could anyone point me in the right direction, because I am clearly doing something wrong.

In reply to uri_unescape differences in IE7 and FF2? by boboson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.