Closed
Bug 936439
Opened 13 years ago
Closed 12 years ago
EncodingUtils should have a method for asking if a string is an encoding that FindEncodingForLabel could return
Categories
(Core :: Internationalization, defect)
Core
Internationalization
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: hsivonen, Assigned: hsivonen)
Details
Attachments
(1 file)
|
2.86 KB,
patch
|
Details | Diff | Splinter Review |
I need this for implementing the replacement encoding.
| Assignee | ||
Comment 1•13 years ago
|
||
Despite the comment, this isn't #ifdef DEBUG, because I have one non-DEBUG use case.
Attachment #829217 -
Flags: review?(VYV03354)
Comment 2•13 years ago
|
||
Comment on attachment 829217 [details] [diff] [review]
Add IsEncoding
>+ // Using labelsEncodings isn't as efficient as possible, but this is mostly
>+ // used for debug build asserts anyway.
What is the non-DEBUG use case do you have? Is this acceptable to it?
How about
nsCString label(aEncoding);
ToLowerCase(label);
return NS_SUCCEEDED(nsUConvPropertySearch::SearchPropertyValue(
labelsEncodings, ArrayLength(labelsEncodings), label, enc)) &&
aEncoding.Equals(enc);
?
| Assignee | ||
Comment 3•13 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #2)
> Comment on attachment 829217 [details] [diff] [review]
> Add IsEncoding
>
> >+ // Using labelsEncodings isn't as efficient as possible, but this is mostly
> >+ // used for debug build asserts anyway.
>
> What is the non-DEBUG use case do you have? Is this acceptable to it?
Rejecting non-Encoding Standard chardet guesses before we figure out if mailnews needs charder to be ably to guess ISO-2022-KR/CN and some Cyrillic encoding whose name escapes me now.
> How about
> nsCString label(aEncoding);
> ToLowerCase(label);
> return NS_SUCCEEDED(nsUConvPropertySearch::SearchPropertyValue(
> labelsEncodings, ArrayLength(labelsEncodings), label, enc)) &&
> aEncoding.Equals(enc);
> ?
OK. I didn't do that, because "replacement" needs special casing, but then I special-cased it anyway for another reason. I'll change the patch.
Comment 4•12 years ago
|
||
Comment on attachment 829217 [details] [diff] [review]
Add IsEncoding
Assuming the new patch will be created.
Attachment #829217 -
Flags: review?(VYV03354)
| Assignee | ||
Comment 5•12 years ago
|
||
It turns out that I didn't need this after all.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•