Closed Bug 1228755 Opened 9 years ago Closed 9 years ago

ASSERTION: language code too short: '(len == 2) || (len == 3)', file intl/locale/unix/nsPosixLocale.cpp, line 126

Categories

(Core :: Internationalization, defect)

Unspecified
Linux
defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

Details

(Keywords: assertion)

Attachments

(1 file)

STEPS TO REPRODUCE
1. (export LANG="C.UTF-8"; firefox )

ACTUAL RESULTS
ASSERTION: language code too short: '(len == 2) || (len == 3)', file intl/locale/unix/nsPosixLocale.cpp, line 126

BUILDS AND PLATFORMS TESTED
Bug occurs in a DEBUG trunk build on Linux.

FYI
LANG="C.UTF-8" is the value Ubuntu gives me with System Settings ->
Regional Settings -> Formats -> Region: Default (C)
nsPosixLocale::GetXPLocale already special-cases the "C" locale. We should probably add special-casing for "C.UTF-8" as well.
Attached patch fix?Splinter Review
Perhaps like so?
Attachment #8693285 - Flags: review?(smontagu)
Comment on attachment 8693285 [details] [diff] [review]
fix?

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

Yes, I think this is the way to go.
Attachment #8693285 - Flags: review?(smontagu) → review+
https://hg.mozilla.org/mozilla-central/rev/fcda0da2ed2a
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
I think this patch is wrong on two counts ( Bug 981463 - Allow one letter "C" as in C.UTF-8 as a valid language code

1. This patch does not seem to work, AND MORE GRAVELY

2. We should not change language code to en_US when the user specifically sets it
to "C".

    I mean, instead of en-US.UTF-8we can assign "js_JP.UTF-8" or whatever, but
    that does not make sense. The user wanted to use "C" as defined in ISO-C or POSIX locale.
So I think using en-US.UTF-8 is quite improper here.

+    if (strcmp(posixLocale,"C.UTF-8")==0) {
+      locale.AssignLiteral("en-US.UTF-8");
+      return NS_OK;
+    }


As for point 1, did the patch work for the original poster?
Under what platform?

On Debian GNU/Linux, it does not work.
 
I prefer the approach in Bug 981463.

TIA
See Also: → 981463
A little more background can be found in Bug 960957
See Also: → 960957
Actually comment https://bugzilla.mozilla.org/show_bug.cgi?id=960957#c20
in 960957 explains why the patch in 981463 was created the way it was written.

TIA
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: