Closed Bug 1089298 Opened 6 years ago Closed 6 years ago

Stop mime decoding to UTF-8 only to convert to UTF-16

Categories

(MailNews Core :: Backend, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 38.0

People

(Reporter: jcranmer, Assigned: jcranmer)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Let's kill this pattern:
nsAutoCString stringToMatch;
nsresult rv = mimeConverter->DecodeMimeHeaderToUTF8(
    rfc2047string, charset, charsetOverride, false, stringToMatch);

nsAutoString utf16String;
CopyUTF8toUTF16(stringToMatch, utf16String);
After bug 998392, a lot of the strings inside JS are stored in latin1 instead of UTF16, does that play into this at all?
(In reply to Robert Kaiser (:kairo@mozilla.com) from comment #1)
> After bug 998392, a lot of the strings inside JS are stored in latin1
> instead of UTF16, does that play into this at all?

AUTF8String is still a nasty conversion, because it's neither UTF-16 nor Latin1.
Assignee: nobody → Pidgeot18
Status: NEW → ASSIGNED
Attachment #8559274 - Flags: review?(kent)
Blocks: 1089301
Comment on attachment 8559275 [details] [diff] [review]
Part 2: Save the needle as a UTF-16 string

Review of attachment 8559275 [details] [diff] [review]:
-----------------------------------------------------------------

1) I believe that you also need to initialize mValue.utf16String in nsMsgSearchValueImpl::nsMsgSearchValueImpl(nsMsgSearchValue *aInitialValue)

2) Can't you use utf16String in nsMsgSearchValueImpl::GetStr(nsAString &aResult) to eliminate that conversion?
Attachment #8559275 - Flags: review?(rkent) → review+
Comment on attachment 8559274 [details] [diff] [review]
Part 1: Pass UTF-16 strings around search instead of UTF-8

Review of attachment 8559274 [details] [diff] [review]:
-----------------------------------------------------------------

I have my doubts as to whether this is worth the effort, but let's try it.
Attachment #8559274 - Flags: review?(rkent) → review+
https://hg.mozilla.org/comm-central/rev/1028fda75e9d
https://hg.mozilla.org/comm-central/rev/4255fc99c7cf
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 38.0
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.