Why is ë percent encoded to %EB but also to %C3%AB?
Asked Answered
P

1

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?

Puncture answered 12/10, 2012 at 14:7 Comment(3)
ë has different byte representations in different charsets.Stylus
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.Meningitis
i think %EB is representation in ISO-8859-1 charset, and %C3%AB is UTF-8 representationKramatorsk
R
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).

Rainy answered 12/10, 2012 at 14:9 Comment(1)
@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.Rainy

© 2022 - 2024 — McMap. All rights reserved.