Forum Moderators: coopster

Message Too Old, No Replies

UTF-8 and urlencode in PHP

Problems URL decoding some strings on my site

         

jonte

1:22 pm on Feb 5, 2006 (gmt 0)

10+ Year Member



I’m having problems URL decoding some strings on my site. First of all, my site uses the UTF-8 charset:
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

Now, when formatting a link on my site I use the PHP function urlencode, which results in the following code:

<a href="/sv/langd/%C3%85ngstr%C3%B6m.html">Ångström</a>

Great, it translated the special characters to some %-formatted codes. Now, on the receiving end it does not seem to understand the %C3%85 part, while the %C3%B6 part is decoded without problems.

I use the Apache module mod_rewrite to rewrite the URL and the Ångström part of the URL gets placed in the GET parameter called part. Doing a:

echo $_GET["part"];

Gives me the output:

&#65533;?ngström

I’m really lost; I’ve been searching all corners of the Web for a solution without progress. Any thoughts? Please give me your $0,02 here.
Thanks,
Jon

tomda

3:14 pm on Feb 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can't answer on this specific danish? character.
Just can give you two useful links:

the W3school Charset page
[w3.org...]

the Unicode Consortium at
[unicode.org...]