0

I have a application made in PHP, on this application I have the option to translate the page with some languages, but if I try to translate to Spanish the characters with accent marks, shows a question mark symbol (�) like: acci�n.

To generate the transalation files, i'm using the following command:

msgfmt messages.po -o messages.mo

On my file .po, with the following structure from top to bottom:

msgid "Yes"
msgstr "Si"

On twig:

{% trans "Yes" %}

My mysql is set to UTF-8(but in this case I'm not using info from the database) , all my .php files are set with UTF-8 encoding, my html pages too. I don't why this happen? Could it be nginx configuration?

heliosk
  • 1,113
  • 3
  • 23
  • 45
  • What if you try this at the top of your PHP file: `header('Content-Type: text/html; charset=utf-8');` – Eduardo Escobar Jul 09 '20 at 19:02
  • 1
    What are the headers (first msgstr) and encoding of your PO file? Probably not UTF-8. – deceze Jul 09 '20 at 19:04
  • my .po header already contains: "Content-Type: text/plain; charset=UTF-8\n" – heliosk Jul 09 '20 at 19:07
  • @heliosk your .po file encoding should be utf-8, but also your PHP file should contain `header('Content-Type: text/html; charset=utf-8');` (in case your webserver isn't sending that HTTP header already). – Eduardo Escobar Jul 09 '20 at 19:45
  • Does this answer your question? [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – Dave Jul 09 '20 at 20:03

0 Answers0