]> granicus.if.org Git - icu/commitdiff
ICU-11421 Fix the baseName of locales created with getAvailableLocales()
authorJungshik Shin <jshin@chromium.org>
Tue, 3 Mar 2015 21:59:25 +0000 (21:59 +0000)
committerJungshik Shin <jshin@chromium.org>
Tue, 3 Mar 2015 21:59:25 +0000 (21:59 +0000)
X-SVN-Rev: 37115

icu4c/source/common/locid.cpp

index f073aadedc89a11ad9c98eaedbfda39c5462d978..794c6f35a6c3f7262b9f03627771fd5c55aaeb28 100644 (file)
@@ -1,6 +1,6 @@
 /*
  **********************************************************************
- *   Copyright (C) 1997-2014, International Business Machines
+ *   Copyright (C) 1997-2015, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  **********************************************************************
 *
@@ -509,6 +509,13 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
         /* preset all fields to empty */
         language[0] = script[0] = country[0] = 0;
 
+        // Need to reset baseName. Otherwise, when a Locale object created with
+        // the default constructor is changed with setFromPOSIXID() later
+        // (e.g. locales obtained with getAvailableLocales()),
+        // baseName will be still that of the default locale instead of one
+        // corresponding to localeID.
+        baseName = NULL;
+
         // "canonicalize" the locale ID to ICU/Java format
         err = U_ZERO_ERROR;
         length = canonicalize ?