5

When I enter ë into a form on my web application, this is percent encoded by Google Chrome to %C3%AB.

When I use PHP's urlencode('ë'); This is encoded into %EB.

Why are the encodings different?

How can I encode with the same encoding as Google Chrome with PHP 4?

i.amniels
  • 1,781
  • 1
  • 25
  • 37
  • 1
    `ë` has different byte representations in different charsets. – mario Oct 12 '12 at 14:08
  • 1
    Are you really on php 4? Anyway, you should look at encoding everything (db, db connection, html) in utf8, that will save you a lot of headaches. – jeroen Oct 12 '12 at 14:08
  • 2
    i think %EB is representation in ISO-8859-1 charset, and %C3%AB is UTF-8 representation – ninaj Oct 12 '12 at 14:10

1 Answers1

8

%EB is the ISO-8859-1 form (a single character).

%C3%AB is the UTF-8 form (e + ¨).

It should work out of the box (if you use a newer version of PHP and UTF-8 for your files).

Alix Axel
  • 151,645
  • 95
  • 393
  • 500
  • @i.amniels: I have no idea, just set up your forms to always submit using UTF-8 (`accept-charset` attribute) and you'll be fine. Also, you should really upgrade your PHP version. – Alix Axel Oct 12 '12 at 14:20