Open Bug 819868 Opened 7 years ago Updated 7 years ago
Consolidate code for converting from various encodings into a UTF-16 string
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
You need to log in before you can comment on or make changes to this bug.