From http://www.webtoolkit.info/javascript-utf8.html