Reputation: 189
Possible Duplicate:
PHP Ansi to UTF-8
I have data that occasionally includes various ANSI Windows ASCII characters (i.e., x99 for TM, xA9 for copyright, xAE for registered trademark, etc). These characters do not display properly in web pages.
Is there a function in PHP that will allow me to automatically convert them properly? Or, do I have to have a ton of str_replace() calls that make each substitution separately? If I do have to use str_replace(), what is the proper way to match the ANSI code? I'm thinking something like:
$str = str_replace('/\x99','™',$str); // trademark symbol
Is there a better way?
Upvotes: 0
Views: 773
Reputation: 133
Look at htmlentities
http://php.net/manual/en/function.htmlentities.php
It converts <
to <
, ö
to ö
etc...
Upvotes: 0