From UTF-16 to UTF-8… in JavaScript

JavaScript Strings are “finite ordered sequence of zero or more 16-bit unsigned integer values.” Usually these integer values are UTF-16 code units. The UTF-16 encoding uses one 16-bit unit for Unicode characters from U+0000 to U+FFFF, and two units for characters from U+10000 to U+10FFFF. Unfortunately all the usual String functions length, charAt, charCodeAt, are …

Fixing Doubly UTF-8 Encoded Text in MySQL

Earlier I wrote about fixing UTF-8 encoded text stored in a latin1 column by converting it back to latin1. What if you want to convert the column to UTF-8 instead? Changing the storage encoding is easy to do, it takes just one ALTER TABLE statement and MySQL converts the column to UTF-8. But afterwards you …

The Ultimate Guide To UTF-8 and MySQL

How character encodings work in MySQL seem to continue baffle people, at least based on the number of questions posted on Stackoverflow. Read on if you have an application that still outputs funny text like “señor” or “se�or” where “señor” is expected. The truth about text in MySQL Strings in MySQL consist of an encoding …