Add a test case for JSC string encoding.
Fix string encoding issue.
Add safety checks to try to avoid an observed crash.