0

I've an issue I've just encountered (once the web app is already up and running for a week!) and I can't seem to solve it, and I'm sort of rushing through it in order to fix it before it continues malfunctioning.

I've coded a neat little Christmas card for a business and the user inputs his/her name and the name of someone else and then sends it, so the card says TO: JOHN, FROM: PAUL, basically.

This info is sent via URL vars and then, of course, I use GET to retrieve it and output the message.

Of course, it's a card one can use from anyone and to anyone... but I tested it only in English (my bad). So when the first Martín or Sören comes around and uses the card, they get From: Martã­n, From: Sã¶ren...

Obviously, that doesn't work.

So I'm guessing I need to find a way either to transform the special character from the input field into the URL or from the URL to the output message. (While we're on the subject: which would you recommend?)

However, I can't get it to work. I've tried finding which character codes work when sent through the URL.

I've noticed URLs usually substitute certain characters and especially white spaces with a % and something else (a coding method whose name I don't know; can anyone enlighten me on that, please?). But when I try %C3%AD, which, according to a website I found, is the code for í, as in my example Martín, I continue to get the ã­, as these codes in the URL are automatically changed to their special character.

I've also tried í, í but to no avail!

3
  • 1
    Are you using UTF-8? Have you tried using php's htmlentities() function to convert a string to see what gets output correctly? Because then you can use html_entity_decode() Commented Dec 22, 2013 at 2:01
  • Can you display your form markup? try accept-charset="UTF-8" Commented Dec 22, 2013 at 2:04
  • Use rawurlencode($str) Take a look [here][1]. Looks like my answer was too short... [1]: stackoverflow.com/questions/2419075/… Commented Dec 22, 2013 at 2:08

1 Answer 1

2

You can try using rawurlencode, check out the examples there. Hope this helps.

http://www.php.net/rawurlencode

http://www.php.net/manual/en/function.rawurldecode.php

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.