Converts character encoding in JavaScript.