5

I've data with special characters (french accent grave). When I select with php script and output (print) it looks fine. When I pass to Smarty the characters get changed. My html has follwoing setting: meta http-equiv="content-type" content="text/html; charset=utf-8" Not sure what's missing or incorrect?

gr, Patrick

Stefan Gehrig
  • 82,642
  • 24
  • 155
  • 189
Patrick
  • 61
  • 1
  • 5
  • In the browser, View -> Character encoding, does it recognize the utf-8 encoding? – Catalin Dec 14 '10 at 13:59
  • Maybe your server sends a content-type header. HTTP headers have precedence over HTML meta tags. – rik Dec 14 '10 at 14:57
  • When you open the smarty file with Notepad++, what do you see to the lower right? You should see "ANSI as UTF-8". By the way, do you `|escape`? In that case, you should supply the second parameter to it: `{$var|escape:'html':'UTF-8'}` as per http://www.smarty.net/docsv2/en/language.modifier.escape.tpl – Halil Özgür Dec 27 '10 at 15:31

1 Answers1

0

Put this at the beginning of yours php file and check:

// utf-8

header("Pragma: no-cache"); header('Content-type: text/html; charset=utf-8');

// mbstring UTF8 coding (optional)

mb_detect_order(array('UTF-8', 'ASCII')); mb_internal_encoding('UTF-8'); mb_http_output('UTF-8'); mb_regex_encoding('UTF-8');