user201892
user201892

Reputation: 277

navigator doesn't know accents (é, è à ....) in symfony2 project

I read a symfony2 tutorial, but when I run my project I have a problem with é, à, è .... I added the tag that allow to use UTF-8 but same problem : here is my page index.html.twig :

 <html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
</head>
 <body>
  <h1>Liste des catégories</h1>
  {% for cat in categories %}
   <p>{{ cat.nom }}</p>
  {% else %}
   <p>Aucune catégorie n'a été trouvée.</p>
  {% endfor %}
 </body>
</html>

How can I achieve this, thank you in advance

Upvotes: 0

Views: 293

Answers (2)

pozs
pozs

Reputation: 36224

To work with UTF-8 in PHP:

  1. save your files in UTF-8, without BOM.
  2. serve you responses with UTF-8 encoding. <meta> is generally not enough for this, you'll need to send the appropriate Content-Type http-header.
  3. use a doctype, at least an html5 one: <!DOCTYPE html>

Upvotes: 1

Evert
Evert

Reputation: 99523

Your sourcefile is probably not actually saved as UTF-8. Check your editor settings.

Upvotes: 1

Related Questions