History log of /libcore/luni/src/main/native/libcore_icu_ICU.cpp
Revision Date Author Comments
ebe417d7808ac5bce5bc14d36d6af4c31218326d 22-Aug-2014 Elliott Hughes <enh@google.com> Support narrow am/pm markers in LocaleData.

Bug: 16938600
Change-Id: I7334c1ea57ea0593b3e0bd7943f8a5208c704881
df624c1cc36dc17e4051d1100a3400aeb4252511 25-Jun-2014 Narayan Kamath <narayan@google.com> Fix handling of invalid locales in Date/DecimalFormatSymbols.

For locales whose language code is "und" we use Locale.ROOT
instead. This also fixes two other corner cases :

- We were using the wrong locale to fetch timezone strings
when the input locale was null. we now use the same locale
throughout by making sure we don't perform any subsititutions
in LocaleData.get.

- Adds a clearer comment about the broken serialization
behaviour.

bug: 15849709

(cherry picked from commit 043a1424a4e3bbb5abc9d9e11c9c088b20f4ca7d)

Change-Id: I716fb421fb8643dedebb3a7797a76ed1dd86c548
ac89b307fd132d44ac55b9109833730cbc2e86fc 21-Jul-2014 Narayan Kamath <narayan@google.com> Implement Locale.forLanguageTag in java.

This prevents us from having to parse ICU locale IDs
or construct them in java. Note that the changes to
LocaleTest bring us in line with the spec (some of the
previous tests demonstrated wonky ICU4C behaviour we
didn't want).

This change includes a minor fix to unicode extension
parsing, we now accept keywords with empty values which
the spec allows.

bug: 15661724
bug: 15849709

(cherry picked from commit bf098bb6345b0917d645d809f4d703e6a0c904f4)

Change-Id: I9b5417dd32bd758655085a484db071959edb774e
5c0472fd7c53464e526bb833707551d85dbafec1 25-Jun-2014 Narayan Kamath <narayan@google.com> Fix handling of invalid locales in Date/DecimalFormatSymbols.

For locales whose language code is "und" we use Locale.ROOT
instead. This also fixes two other corner cases :

- We were using the wrong locale to fetch timezone strings
when the input locale was null. we now use the same locale
throughout by making sure we don't perform any subsititutions
in LocaleData.get.

- Adds a clearer comment about the broken serialization
behaviour.

bug: 15849709

Change-Id: I95e7eb0ccb7458711038ce9b1c76b3279acda9d6
bf098bb6345b0917d645d809f4d703e6a0c904f4 21-Jul-2014 Narayan Kamath <narayan@google.com> Implement Locale.forLanguageTag in java.

This prevents us from having to parse ICU locale IDs
or construct them in java. Note that the changes to
LocaleTest bring us in line with the spec (some of the
previous tests demonstrated wonky ICU4C behaviour we
didn't want).

This change includes a minor fix to unicode extension
parsing, we now accept keywords with empty values which
the spec allows.

bug: 15661724
bug: 15849709

Change-Id: If9417ab4cb545fdb8b9a0a47a7eade6ebbe33ba8
ca6c2dfd21fef61f179223fb710db791802068d5 18-Jun-2014 Narayan Kamath <narayan@google.com> Fix getISO3Country and getISO3Language.

For backward compatibility, locales constructed with 3 letter
countries and languages must return those languages and countries
from these methods. With our strict language tag interpretation, these
were being omitted or transformed to und.

We fix this by passing only the language code (or the country code
with a fixed language) down to ICU, which will then deal with it
correctly.

bug: 15638049

Change-Id: I517a82496a2a4c36b1ae9234f7d2d4eb89b34ffe
5133494975abc1ab7e9afc779dfda18cf46be079 11-Jun-2014 Narayan Kamath <narayan@google.com> Remove unnecessary loop in uloc_forLanguageTag.

When uloc_forLanguageTag fails with a
U_STRING_NOT_TERMINATED_WARNING or with a
U_BUFFER_OVERFLOW_EXCEPTION, we know precisely
how many characters we need to allocate to make the
call succeed.

Change-Id: Ie761b9c7279d3c6f6d432285155a7087fab6d066
12ca8820818b604c6fc30f025857ec443c83d4a3 11-Jun-2014 Narayan Kamath <narayan@google.com> Implement Locale.toLanguageTag without ICU support.

This is the first part of an effort to avoid having
to construct and parse ICU locale IDs and to instead
use language tags as inputs to all ICU APIs.

Only one minor unit test adjustment was required, and
that change brings the test closer in line with the
spec.

Change-Id: I8abc0e3b868dd73e4fb9e36b6db19853eb99e6ac
a94266074c7b82720fd2cecfb37ab8da85f1b296 30-May-2014 Elliott Hughes <enh@google.com> Pass BCP-47 tags and not Locale.toString results to ICU.

ICU can't handle the new toString forms for scripts etc.
and it's also guaranteed to deal with BCP-47 tags correctly.

Most of the changes in this patch are required to keep
backwards compatibility for getDisplayCountry string etc. in
the face of the transformations toLanguageTag performs.

A few tests were changed, but for the better.

The tagalog -> filipino charlie foxtrot will be dealt with
in a follow up change.

Co-Authored-By: Narayan Kamath <narayan@google.com>

Change-Id: Ia7f26d92a0e38c4bbb1d839c0fbd8ad16a473bf5
1ff70d59a9ac0cafce11c9b1e6e98785dabc8979 09-May-2014 Elliott Hughes <enh@google.com> Add missing 'const'.

Change-Id: I20311836b80bc655a5ae389ef2f49b2a09f79744
3879b91e1baee17ecd51c653200ebdafc011020c 08-May-2014 Elliott Hughes <enh@google.com> Ensure consistent (backwards-compatible) capitalization for yesterday/today/tomorrow.

Bug: 14493853
Change-Id: I971ffc2d47534aef67df951725fcd16802ea6d54
de0eb683370d789e7bb25673b350b8dbf2ba5d69 11-Apr-2014 Narayan Kamath <narayan@google.com> Set ICU's default locale from Locale.getDefault.

bug: 2541757
Change-Id: I5de58be7e8a701f2c40182ea54bceff85ec1aad2
4f3bca749bdc8be8abf7555b315f308a2c8c14a7 13-Mar-2014 Narayan Kamath <narayan@google.com> Don't assume minusSign is a single char.

Locales like arabic have a multi char minusSign in
their locale data.

The only difficulty here is presented by DecimalFormatSymbols,
which is a public API and expects the minus sign to be
a single codepoint. The API has been changed to return the
first character of the minusSign string for getMinusSign, which
seems like the least bad option at this point.

This change also removes a workaround for cases where ICU
parsed (2445-) as (-2445) for RTL locales. ICU-52 doesn't do
this anymore.

The serialized form hasn't been modified either, since it's
public API as well and it isn't easy to expand to a String
without awkward semantics.

bug: 13410257

Change-Id: I0e575b7eea0fd811ccb9fb5dc04e20d2e0fa13bf
11c1f6f38955e0ec20d86ca70891f30bf5f5e4bb 13-Mar-2014 Narayan Kamath <narayan@google.com> Fix ICU glue for uloc_toLanguageTag.

There were several issues :
- ICU does not set the output param UErrorCode* to U_ZERO_ERROR
when an API call is successful, so we need to clear it before every
API call.
- ICU sets the error code to U_BUFFER_OVERFLOW_ERROR (and sets the
output length to the required size) if the input buffer is too
small.
- ICU sets the error code to U_STRING_NOT_TERMINATED_WARNING when
the input buffer is one character too short.

bug: 13414549
bug: 13412659
Change-Id: I3e23ea507a540f37ab1c14a60afe801bca286554
d627bd4525e41b0503f94c2887c3e01618c73105 10-Mar-2014 Neil Fuller <nfuller@google.com> Add Currency.getNumericCode()

getNumericCode() was added in Java 1.7. It returns the ISO 4217
numeric code for a currency.

Change-Id: I8404703e749b3324bbcb89ecf6d8d64b95a030a3
c5b1eb191102a20bc0626aea955aba417e337fbc 10-Jan-2014 Narayan Kamath <narayan@google.com> java7: Implement new Locale APIs.

Most validation and sanity checking is performed entirely
in java. We use ICU only for converting back and forth
between Locale objects and BCP-47 language tags
(toLanguageTag & forLanguageTag).

The new APIs also add support for script subtags and
manipulation of unicode locale extensions.

Note that we do not implement
IllformedLocaleException.getErrorIndex. If anyone complains
or if it proves useful somehow, we could plumb the information
through from ICU if required.

bug: 8992787
Change-Id: I9b2d7f8d17f970d1b57111dcfe92c16e68b0fa67
2496a680ade790744df6815bbb6ed144a7028b87 31-Oct-2013 Elliott Hughes <enh@google.com> Add a cache to ICU.getBestDateTimePattern.

Brings the time down from 7ms to 7us for a cache hit on Nexus 4.

Bug: 11447043

(cherry picked from commit 0fd776f4dbf7c1940c080003f0c7a02d35374ab9)

Change-Id: I6659ff8ea29227777db0c359024f1361a7cb47e6
0fd776f4dbf7c1940c080003f0c7a02d35374ab9 31-Oct-2013 Elliott Hughes <enh@google.com> Add a cache to ICU.getBestDateTimePattern.

Brings the time down from 7ms to 7us for a cache hit on Nexus 4.

Bug: 11447043
Change-Id: I7cfc055c264ce49dadc72b5acdc2f2b0b339a5a1
28b4fe31c6a2ab75ae01afdf1abd5f72f05aaa17 02-Sep-2013 Carton He <carton.he@marvell.com> Fix memory leak when using DateTimePatternGenerator

Instance created by DateTimePatternGenerator::createInstance() needs to
be deleted

Signed-off-by: Carton He <carton.he@marvell.com>

(cherry picked from commit 364324db9cf267b0a770238536a18da719f9295b)

Bug: 10611001
Change-Id: Iea5301d71194ea04de08bd4f4fe26c27f37c77c8
4a01f60804080f5e01873c218be287d456ad0d32 04-Sep-2013 Elliott Hughes <enh@google.com> Remove some unnecessary native code for LocaleData.

We already have a more general implementation, exposed as public
API >= jb-mr2.

(cherry picked from commit 783112d47e2236b6a7e2315c2e50166d755422a7)

Bug: 10611001
Change-Id: I5dc1c6588c183783053549e1052a475465d380e5
364324db9cf267b0a770238536a18da719f9295b 02-Sep-2013 Carton He <carton.he@marvell.com> Fix memory leak when using DateTimePatternGenerator

Instance created by DateTimePatternGenerator::createInstance() needs to
be deleted

Change-Id: I3e6058f717e56dbc06ffaca35ff6ae06059b689d
Signed-off-by: Carton He <carton.he@marvell.com>
783112d47e2236b6a7e2315c2e50166d755422a7 04-Sep-2013 Elliott Hughes <enh@google.com> Remove some unnecessary native code for LocaleData.

We already have a more general implementation, exposed as public
API >= jb-mr2.

Change-Id: I917465f6bac4afec40e3685dccffad920d050c85
8a491f87e3c35d08888676ac8c3e66b7fe1fafdd 04-Sep-2013 Elliott Hughes <enh@google.com> Use getLocale more consistently.

Change-Id: I64d9e651aba3b2872a23e4d4b1b7c32c34f86d90
aaf01db628576a4e8c76c23b94d12adeefb7bbae 26-Aug-2013 Elliott Hughes <enh@google.com> Fix the Charset alias generation to use the correct icu4c API.

Bug: 10492721

(cherry picked from commit 783a57a7ece339bc246925e328bc82b50cae427a)

Change-Id: I53bbdf459944c6b5bcb134cae29c541bba17d2f8
783a57a7ece339bc246925e328bc82b50cae427a 26-Aug-2013 Elliott Hughes <enh@google.com> Fix the Charset alias generation to use the correct icu4c API.

Bug: 10492721
Change-Id: Ie81b8aca9d7531d0fd8476ccab78653b0aa68755
f001abe6478c2ece3d86138f649a5459de85a50a 25-Jul-2013 Elliott Hughes <enh@google.com> Fix LocaleNameIterator.

The intention -- as stated in the comment -- is that we should iterate all the
way up to the root locale, but we were missing that out. Some locales (such as
'ne' currently) actually inherit data from the root. (Yes, this is probably a
bad sign as to their completeness.)

Change-Id: I9033c7a0ba477ae9c7523a6c707dafd664394603
480537d9d51add98bffe6d9a9ef3b1022b959336 03-May-2013 Elliott Hughes <enh@google.com> Add an icu4c-based DateIntervalFormat.

This will be used to replace DateUtils.formatDateRange's implementation.

Bug: 7289514
Change-Id: I5588c79a9d0a5cbed3b4600389c545e83fc26967
0ef9944d1968207ae8501aca5f904809320c520e 19-Jun-2013 Elliott Hughes <enh@google.com> Fixes for icu4c 51.

Change getYesterdayTodayAndTomorrow to cope with the new data layout.

Extend getDateFormatOrder to cope with 'G' in fa's preferred yyyyMMdd
pattern.

Fix a few tests to correspond to data changes.

Change-Id: I2478ae960ff6ec0b9a95290132c0ae0d5d8eff5a
15d82808bab24f399a034d086f587d5fab32522e 27-Feb-2013 Elliott Hughes <enh@google.com> Make the CLDR version available.

Change-Id: I745b0153ae1dd9eb24dc02b19ac5ab34638a07e3
3aac4ddc4d17c07fa8b4908069d23d5401a77993 05-Feb-2013 Elliott Hughes <enh@google.com> Add icu4c-backed transliteration.

Change-Id: I4194810646a2a0661331aaf941fb5f99ce7758b1
4f32b7933626e100fca505484f8b4636f3342e5e 14-Jan-2013 Elliott Hughes <enh@google.com> Make CLDR's 12- and 24-hour time formats available.

Bug: 7924970
Change-Id: I392e8110885f662f32caae46d961ca6e9e4301d7
007776e50b6305e2c4551f8ace682fffab412202 02-Nov-2012 Elliott Hughes <enh@google.com> Don't create as many temporary icu4c Locale objects.

Change-Id: I70c7c178d98958633db8341e1d66931ce037c6c7
a49a1e8c20b3cf9435ed422379f63e33e5c2eaf2 19-Oct-2012 Elliott Hughes <enh@google.com> Fix the pt_PT currency symbol (€ rather than ¤).

Bug: http://code.google.com/p/android/issues/detail?id=38622
Change-Id: I70bcf1d994e8467a32bdbdaa410067c6775fe889
f5df21ec7d504bed329d5d682981021363424338 05-Oct-2012 Elliott Hughes <enh@google.com> Remove unnecessary #include.

Change-Id: Ie95f39627ed068818b323e03bdbe7765285409d2
cb1b9026b8aa993785c4d54f686905522b7959b9 04-Oct-2012 Elliott Hughes <enh@google.com> Add ICU.getBestDateTimePattern.

Bug: 7204705
Change-Id: I0c65745178182f992d1d0ba0f0d56768194e2084
680b1e27caf10e3c41ec9f022054ab53d3a6bf7a 16-Aug-2012 Elliott Hughes <enh@google.com> Remove an obsolete hack for ps and ps_AF.

Made obsolete by external/icu4c change 6384944cabfb536f4ec5d584e26927405f150770.

Change-Id: Iefecb23ef87335e9f7f659f54dcdc3b36d5b4c62
c4e0797a4dd028d23e788da15c3055f83f6f37d5 15-Aug-2012 Elliott Hughes <enh@google.com> Revert "Revert "Add support for returning the CLDR "Yesterday", "Today", and "Tomorrow" strings.""

This reverts commit 73dc486a74a67ce375e3d90dcfaa6b5255b7c0da

I've added code to handle falling back to parent locales to find relative
day names.

Change-Id: Iec2eebb62c0cbb5f6ce625365de514d80ddc05f7
73dc486a74a67ce375e3d90dcfaa6b5255b7c0da 15-Aug-2012 Elliott Hughes <enh@google.com> Revert "Add support for returning the CLDR "Yesterday", "Today", and "Tomorrow" strings."

This reverts commit 774294d74fe02e2b5040fcc2feb9f9d0913a4c77

This patch didn't work for locales that didn't explicitly specify values (and relied on fallback), and caused hard failures in those cases.

Change-Id: I7e3a45cc4d39317c8e523c2ee951c49e0aa8e811
774294d74fe02e2b5040fcc2feb9f9d0913a4c77 15-Aug-2012 Elliott Hughes <enh@google.com> Add support for returning the CLDR "Yesterday", "Today", and "Tomorrow" strings.

This will let us remove a little more of the duplicate (and unmaintained)
CLDR data from frameworks/base.

Change-Id: Idbdb755e8469bb46e7597775ed2139c47de24b39
ad66a888b2e48b1a185de1b3c73fd01383a1fd04 06-Aug-2012 Elliott Hughes <enh@google.com> Offer "J" in addition to "January" and "Jan".

The frameworks/base XML had out-of-date copies of this CLDR data, which
isn't accessible via SimpleDateFormat. Offer the strings direct from icu4c
so we can use them in frameworks/base.

Change-Id: If97dac05bcbb36542b209b19ae590e8b30aedb7b
5ec69b20ab9b3e2dcbe225d548168b09afbbbac2 24-Jul-2012 Elliott Hughes <enh@google.com> Clean up ICU error reporting.

Throw all ICU exceptions from the native side, and include the name of the
function that failed.

Bug: 5037042
Change-Id: I49b5493a7e7365226d612479294b5b8f47ec4e8c
7cd6760f7045d771faae8080a8c6150bf678f679 04-May-2012 Elliott Hughes <enh@google.com> Make libjavacore independent of libnativehelper for the PDK.

Bug: 6369821
Change-Id: Ie038571a5dac1f301c0c3c6fb84df432e67b62c0
5b7b7fe6a817fdf058eefd9a716cc58a3283eb05 12-Jan-2012 claireho <chinglanho@gmail.com> Libcore changes for ICU4.8.1.1 upgrade.

This CL includes:
1. Change libcore_icu_ICU.cpp and LocaleData.java to support locale data structures in ICU4.8.1.1.
The new libcore_icu_ICU instantiates ICU objects instead of reading the ICU resource files
directly. This could avoid the code change for future ICU upgrade.
2. Change the libcore tests data caused the test failures from ICU locale data change.

Change-Id: Ia3dfb0a8e5c4ccc2ad110a1ff4211ff97fe5b2ad
679cf68b607e9b4a3beb8bcdee06868ae583386f 08-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: I3deb0b1b71cf4ec6d82921a2e0015c3a7b397cbf
06f039b4c39bee1b0618f40d4d4af0d0f2bef2fa 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: Ia340ff04d8e9c6344df07a9f921147d06f367bfe
4c94a6128d1fcfaa75539b36c9f50d0c75df6144 16-Jun-2011 Fabrice Di Meglio <fdimeglio@google.com> Add ICU.getScript()

- needed for RTL support

Change-Id: I03796c25b965403432b79f21ef8ce2f3a4f5566a
e2377cdd707b830d07a5708216834f7ac76ee3e1 15-Jun-2011 Elliott Hughes <enh@google.com> Remove the LocaleData.digit field.

ICU 4.6 no longer supports this, which always had the constant value '#'.

Also ensure that we cache all the locale data (not just the zone strings)
for the root locale, en_US, and the user's locale when the Zygote starts
up.

Also improve the ICU JNI code's local reference usage somewhat.

Change-Id: I28692d9484aecc29820c201b08b8bedd3f26df83
0452e9adf6fb133b6d3e59ebae2135aa90ad0d5e 08-Jun-2011 Fabrice Di Meglio <fdimeglio@google.com> Add addLikelySubtags() to ICU

Change-Id: Ied6149b68452db879c902b544b5b69802e35ff8e
3be1277a4644a149c158f99febbab890fc7b708f 09-Jun-2011 claireho <chinglanho@gmail.com> Libcore changes corresponding to ICU4.6 upgrade.

1. libcore_icu_ICU.cpp: ICU resource files format change.
2. OldCharset_SingleByte_ISO_8859_11.java : charset alias name change.
3. CollatorTest.java : Collation key value change.
4. Pattern2Test.java : character property change - pick another char with Me property.

Change-Id: Iff80c6098f5fd7c82b07e41b4532548d98448ad7
bef9ec33e1368f57c731fce63b6a8c61628c64b0 19-Apr-2011 Elliott Hughes <enh@google.com> Clean up ICU exception throwing.

Change-Id: Ifce086e1fb20b7cb99673f4d38c8c56144328295
52b310afcffe8b6aed6fa0c1e9e8b0ade6f0a672 04-Mar-2011 Elliott Hughes <enh@google.com> Git threw away my changes to a file that had been renamed.

Manually patch the ICU.cpp changes into libcore_icu_ICU.cpp. Also remove the
whole sentence from the class documentation, since it looks rather odd without
the bit that would refer to @hidden API.

Bug: 3484927
Change-Id: I1ea046e18949ad5bfa7f4512df1f481c81a94310
57d0a10f4fa6cae6d5c63b4f799e048e83c5d11e 03-Mar-2011 Elliott Hughes <enh@google.com> Make all filenames match their classes.

Change-Id: I2c9f95a27ee3881fc609e3e4f1468205c701215d