possible fix for encoding issues

Decodes JavaScripts UTF-16 to UTF-8 before saving, see http://ecmanaut.blogspot.co.uk/2006/07/encoding-decoding-utf8-in-javascript.html