Fix UTF32 <-> JS string conversion for non-BMP characters. Turns out JS string functions .length, .charCodeAt and .fromCharCode do not operate on Unicode code points, but UTF-16-encoded Unicode code units.
Update utf32 test to contain non-BMP characters in the test string.
Fix UTF-16 surrogate detection.
Add support for marshalling UTF-16 strings to/from JS. Allows passing wchar_t strings to JS when building with -fshort-wchar. Closes #1565.