Closed Bug 819868 Opened 12 years ago Closed 4 years ago

Consolidate code for converting from various encodings into a UTF-16 string

Categories

(Core :: Internationalization, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: hsivonen, Unassigned)

References

Details

There seems to be some code duplication among nsContentUtils::ConvertStringFromCharset nsScriptLoader::ConvertToUTF16 nsXMLHttpRequest::AppendToResponseText TextDecoder::Decode These should (potentially with an exception for nsXMLHttpRequest::AppendToResponseText) use the same code. Furthermore, the code should probably be more careful about making the right tradeoff between wasting memory and avoiding copying. I suggest allocating the target string’s buffer for the worst case, decoding directly into the target string’s buffer and then having the string itself downsize its buffer if the string actually fits in a smaller jemalloc bucket than what it has. See also bug 497204.
I'm considering making TextDecoder::Decode callable from C++ and using it wherever possible.
Summary: Consolidate code for converting from various encoding into a UTF-16 string → Consolidate code for converting from various encodings into a UTF-16 string
Depends on: 841802

The remaining cases are now sufficiently specialized that it doesn't make sense to unify them.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.