Closed
Bug 352856
Opened 18 years ago
Closed 18 years ago
Provide guaranteed way to create a JSString from a UTF8 char*
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 315288
People
(Reporter: bzbarsky, Unassigned)
Details
Right now we have several cases (xpcconvert, nsJSNPRuntime) where we do a UTF8->UTF16 conversion in Gecko, then call JS_NewUCString on the result. With the recent UTF8 work on the JS engine, is it possible to use JS_NewStringCopy* or something instead? Is there a version that guarantees that it is and will remain UTF8?
Comment 1•18 years ago
|
||
See bug 232182, which morphed and was closed, but still depends on the real bug to fix here: bug 315288. Asking question in a bug summary is not good use of the bugsystem IMHO. I think this is a dup of bug 315288. But I'll make this bug depend on that bug instead, in case I am missing something and being grumpy for no good reason :-/. /be
Depends on: 315288
Comment 2•18 years ago
|
||
Note that even with JS_C_STRINGS_ARE_UTF8 defined, any use of the char (byte sized character) JS string API (e.g., JS_NewString) will still decode into UTF-16 for storage in a jschar (uint16) buffer. If this bug is really asking JS to store UTF-8, not just support it via the char string API, the summary should be fixed. /be
Reporter | ||
Comment 3•18 years ago
|
||
> I think this is a dup of bug 315288
If so, we should file separate bugs on the Gecko code that could use this...
Let me resummarize to make it clearer what I want out of the JS engine here. ;) I just want to pass in a UTF8 char* and then have the JS engine deal with conversion to UTF16 (actual conversion, not byte-inflation). Then I can remove various Gecko code that does that manually right now. But I don't want to do that until there's an absolute guarantee that whatever JS engine API I'm using is UTF8 and will stay that way.
Summary: Is it possible to use the JS engine for UTF8->UTF16 string stuff? → Provide guaranteed way to create a JSString from a UTF8 char*
Comment 4•18 years ago
|
||
(In reply to comment #3) > > I think this is a dup of bug 315288 > > If so, we should file separate bugs on the Gecko code that could use this... > > Let me resummarize to make it clearer what I want out of the JS engine here. > ;) I just want to pass in a UTF8 char* and then have the JS engine deal with > conversion to UTF16 (actual conversion, not byte-inflation). Then this is a dup of bug 315288. > Then I can remove > various Gecko code that does that manually right now. But I don't want to do > that until there's an absolute guarantee that whatever JS engine API I'm using > is UTF8 and will stay that way. Filing this bug does not make the JS_C_STRINGS_ARE_UTF8 any more absolute than it already is. Its name says what it does unambiguously given brevity needs. /be *** This bug has been marked as a duplicate of 315288 ***
You need to log in
before you can comment on or make changes to this bug.
Description
•