Mobile app version of vmapp.org
Login or Join
Sent6035632

: How does the web server choose between unicode and utf-8 for accented characters? I have a web server with my ISP which replaces accented characters in URLs with their unicode values: for instance

@Sent6035632

Posted in: #Apache

I have a web server with my ISP which replaces accented characters in URLs with their unicode values: for instance é (eacute) is translated to %e9 (dec 233).

For testing locally I use EasyPHP which translates those characters by their utf-8 equivalence: é is then replaced by the well known sequence %c3%a9 (é)...
Browsers served by EasyPHP don't decode unicode values but they do if running locally (utf-8 and non converted accent also)...

I have been unable to find where this behavior is configured in the server.

This is a problem as some urls are built by my application using the php rawurlencode() which seems to always encode with unicode values on both servers.
Any idea?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent6035632

2 Comments

Sorted by latest first Latest Oldest Best

 

@Sims2060225

To change the default character encoding, you need to edit your Apache configurations (httpd.conf):

AddDefaultCharset utf-8

10% popularity Vote Up Vote Down


 

@RJPawlick198

There is multiple ways to set character encoding.


php.ini - default_charset = "utf-8"
php header - header('Content-Type:text/html; charset=UTF-8');
html meta - <meta http-equiv="Content-type" value="text/html; charset=UTF-8" />
.htaccess - AddCharset UTF-8 .html


For more on the subject check out UTF-8: The Secret of Character Encoding or PHP UTF-8 cheatsheet and mbstring runtime configuration

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme