Closed Bug 1509849 Opened 7 years ago Closed 7 years ago

Creating a Locale from an empty string should result in non-wellformed Locale

Categories

(Core :: Internationalization, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

Attachments

(2 files)

Currently, trying to construct a Locale from an empty string will raise an assertion (in debug builds), but then leave the resulting object empty but still marked as well-formed, AFAICS. I think it would be more logical to simply treat an empty string as not-well-formed, like we do for any string that contains non-ASCII characters. (I happened to hit this assertion in bug 1503157; I fixed it for now by explicitly checking for an empty lang string before trying to create a Locale, but I think it'd make more sense to just let the Locale be created as non-well-formed, rather than requiring the caller to check for non-empty ahead of time.)
:zibi, does this seem logical to you, or is there some reason we can't simply treat an empty string this way?
Attachment #9027523 - Flags: review?(gandalf)
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Assuming we do the above, we can then revert the followup I pushed in bug 1503157 when it turned out to hit the empty-string assertion.
Attachment #9027524 - Flags: review?(gandalf)
Comment on attachment 9027523 [details] [diff] [review] Treat an empty string as non-wellformed when creating Locale, but don't throw an assertion Review of attachment 9027523 [details] [diff] [review]: ----------------------------------------------------------------- ahh, yeah! thanks Jonathan!
Attachment #9027523 - Flags: review?(gandalf) → review+
Attachment #9027524 - Flags: review?(gandalf) → review+
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/e8eaf7539ccb Treat an empty string as non-wellformed when creating Locale, but don't throw an assertion. r=gandalf https://hg.mozilla.org/integration/mozilla-inbound/rev/2fdce5544015 Revert the followup from bug 1503157 now that an empty locale string is handled properly by the Locale constructor. r=gandalf
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: