Javascript browser charset rendering detection
Just don't. Standard practice is to use UTF-8 everywhere possible, and get rid of all other encodings. Especially if you have a multilingual system, dealing with multiple legacy encodings is a huge headache — just like this code above.