Closed Bug 40461 Opened 20 years ago Closed 20 years ago

implement NS_ConvertUCS2toUTF8()

Categories

(Core :: XPCOM, defect, P1)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: waterson, Assigned: waterson)

References

Details

Attachments

(3 files)

Provide UCS2-to-UTF8 conversion (other than the always-allocating 
ToNewUTF8String).
Please ignore patch #1. I had the "hand off ownership" done wrong in 
ToNewUTF8String(), and had also carried over a bug with first-pass length 
calculation from the original source.
ftang: could you also take a look at these changes? I'm re-implementing 
ToNewUTF8String() in terms of a global helper class, NS_ConvertUCS2toUTF8(). 
N.B. that I think I fixed a bug with UTF-8 first-pass length calculation as 
well (you had the masks inverted bitwise).
Blocks: 40601
I need this for 10373, and probably 28787, too. Can I get transitive closure of 
[nsbeta+] from these bugs, please?
Blocks: 10373, 28787
Keywords: nsbeta2
Status: NEW → ASSIGNED
Priority: P3 → P1
Target Milestone: --- → M17
These changes look reasonable, but be aware that I will probably later refactor 
to move the work of the |Init| method to a function |NS_CopyUCS2toUTF8( const 
nsAReadableString& aUCS2source, nsAWritableCString& aUTF8destination )|, which I 
will then call from |Init|.  This work will actually be done by creating a 
special char-sink so that all the work is done in |copy_string|.

If you have some reasonable tests cases, and this code passes, check in at will.
Didn't I convince you guys to follow the nsFoo class-naming convention?

/be
fix checked in, r=scc,brendan
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
- Per last comments, age of bug, and no reopen - Marking Verified/Fixed.  Please 
reopen if still a problem. 
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.