Subj : Re: Mixing up parameters in setProperty callback To : Sterling Bates From : Brendan Eich Date : Mon Dec 15 2003 11:21 pm Sterling Bates wrote: >>The reason that symptom bites is because without the JS_ShutDown call, >>the deflated string cache holds onto char[] strings decimated from JS >>strings due to calls to JS_GetStringBytes, an ancient API that "cannot >>fail" and that takes no cx parameter, associating each such >>chopped-down-to-8-bit-char string copy with the 16-bit-char JSString >>GC-thing whence it was chopped. > > > Gotcha. I'm guessing that JS_GetStringChars is the replacement. That'll > help tremendously. Right -- JS_GetStringBytes goes back to 1996, when the engine lacked Unicode support(!). JS started out using ISO-Latin-1 chars stored in bytes, in the Nav2/3 era. Some pages stored locale-specific, multibyte character encodings in strings. The dark ages. JS_GetStringChars is the only way to get the full, unchopped chars, although sometimes, when you're debugging or hacking in known-ASCII settings, JS_GetStringBytes is still a win. But it should be avoided in general for good i18n hygiene. /be .