Wednesday, September 19, 2012

php: Rendering text files in UTF-8

Pure .txt (even .utf8) files are rendered not as its natural encoding under Chrome (Version 21.0.1180.89 at present time). Then how to tell the browser to display it in the preferred encoding? We wrap it up via php and tell browser it requires utf-8.
  header('Content-Type: text/plain; charset=utf-8');

No comments:

Post a Comment