0

I'm moving a site to a new Server, and I'm getting wrong colation in non-english caracters in the new one. In the old server I get "é" in the new one shows " �"

Some tips:

a) Both sites are reading from the same MySQL server, so, the problem isn't any MySQL Server configuration. The static HTML also shows wrong caracters, not only strings coming from the database.

b) Both sites have exactly the same source code. So, there is not anything like just put a <meta charset="UTF-8">

c) Old Server user PHP 5.5.9 the new one PHP 5.6.30, both Ubuntu/Nginx

d) I have checked both php.ini files, I saw no diferences!

e) When a do the shell command curl -I *URL* I GET:

Old Server:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 01 Mar 2017 20:00:43 GMT
Content-Type: text/html
Connection: keep-alive
Keep-Alive: timeout=60
X-Powered-By: PHP/5.5.9-1ubuntu4.20

New Server:

HTTP/1.1 200 OK
Server: nginx/1.10.1 (Ubuntu)
Date: Wed, 01 Mar 2017 20:01:21 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive

I sow this Content-Type: text/html; charset=UTF-8 in the answer of curl -i to new server, but I have no idea where it came from.

Any Idea where to find the problem?

Old Server: http://www.pimentaingressos.com/ New One: http://pimenta.curtipiu.net/

  • Possible duplicate of [UTF-8 all the way through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – Qirel Mar 01 '17 at 21:32

1 Answers1

0

For Mysql:

  1. Check your database chararter set : http://php.net/manual/en/mysqli.get-charset.php
  2. Set it if needed with http://php.net/manual/en/mysqli.get-charset.php
  3. More debug info maybe http://php.net/manual/en/mysqli.character-set-name.php


For PHP
  1. Check you PHP encoding capability: http://php.net/manual/en/function.mb-list-encodings.php

  2. If you use output buffer : http://php.net/manual/en/function.mb-output-handler.php

  3. You can set PHP internal ecnoding http://php.net/manual/en/function.mb-internal-encoding.php

  4. More on the MultiByte http://php.net/manual/en/ref.mbstring.php

On my live host, i only needed to fix the collation in phphmyadmin to make it work. On my VM for dev, i need to set the internal encoding (point 3 of PHP list) as well. Over the years i've encountered 1 or more of those thing i listed you hope it set you on the right track.

Louis Loudog Trottier
  • 1,367
  • 13
  • 26