I’ve been using a couple of methods on a simple class, which have worked ok for me, but I’ve noticed that they are really slow due to strtr() and having a ton of translations defined. Also it is really long and thus, more difficult to maintain and understand.
That said, all of the “bad” examples are solutions to real-world issues which have come up, translating strings into UTF8.
Can anyone tell me of there’s a well known or more efficient means of doing this? (yes, I’ve tried the htmlentities() methods and the iconv()methods but neither really replaced all the funky characters correctly.
Here’s the class I’m using currently:
https://gist.github.com/2559140
mbstring support is now enabled (but not loaded) by default as of PHP 5.4.0. Loading the extension, this lets you do: