Foreign Language Characters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ILoveJackDaniels
Forum Commoner
Posts: 43
Joined: Mon May 20, 2002 8:18 am
Location: Brighton, UK

Foreign Language Characters

Post by ILoveJackDaniels »

I need to pass various variables in a URL, and something seems to be happening to them along the way. For example, passing "Français" in the URL, then simply echoing it straight away gives "Fran%C3%A7ais". I tried urldecode, and that printed out "Français".

Does anyone know why these characters are converted in this way, and does anyone know a method for returning them to their proper value once passed through a URL?
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

Have you tried urlencode()ing the string before putting it into the url, and then urldecode()ing it back again?
User avatar
ILoveJackDaniels
Forum Commoner
Posts: 43
Joined: Mon May 20, 2002 8:18 am
Location: Brighton, UK

Post by ILoveJackDaniels »

I have now :)

Thankyou. Still don't understand what happened to the characters in the first place, but lots of urlencoding and decoding seems to have done the trick.
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

It has to do with the UTF value of the character. UTF (Unicode Transformation Format) is a text format whereby every character of every writing system on the planet is represented, but as such, it often takes up to 3 times the space per character to store text in Unicode. Unicode isn't a de facto standard yet, because a lot of applications would rather shorten a 6-byte character into a 1-byte character (ASCII), so a "ç" turns into "ç" when you're editing french unix textfiles in Windows. It's a flaw inherent when any two standards meet - which one is better, and as such, which one prevails?
Post Reply