0

I am adding spanish as a language and I'm having problems with the encoding.

All the spanish characters work perfectly locally (this makes it harder to debug):

enter image description here

But on the server they look this way:

enter image description here

I'm pretty puzzled, you can see the beta version here.

My doctype and charset are the following:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
...

Which should be correct as far as I understand.

I am using gettext for translations.

I checked and the declared encoding of the .po file is UTF-8.

I also set bind_textdomain_codeset to UTF-8.

I'm not sure where the problem is actually relying.

Trufa
  • 39,971
  • 43
  • 126
  • 190

1 Answers1

3

Your server is set to serve pages with this Content-Type header:

Content-Type:text/html; charset=iso-8859-1

You need to tell it to serve them as charset=utf-8 instead. You can do this in PHP too:

header('Content-Type: text/html; charset=utf-8');
deceze
  • 510,633
  • 85
  • 743
  • 889
  • Awesome, it works perfect! but I don't understand where the problem is exactly, why is the server serving another charset? – Trufa Dec 02 '13 at 16:01
  • Because its default is set differently than your local server. This has nothing to do with what charset you're actually sending, it's just a default line the server adds if you don't do it yourself. – deceze Dec 02 '13 at 16:03
  • 2
    @Trufa - The server will not waste resources reading your documents and trying to guess what their encoding is. You have to set it explicitly. (Furthermore, guessing would not work.) – Álvaro González Dec 02 '13 at 16:04