Commit graph

55 commits

Author SHA1 Message Date
Fredrik Roubert
83726260ef ICU-23031 Reinstate special case for "-u-va-posix" lost by ICU-22520.
Inside of locimp_forLanguageTag() in _appendKeywords() in uloc_tag.cpp
there's a hardcoded special case for "-u-va-posix" which appends the
"_POSIX" variant but this was missed during the refactoring made for
ICU-22520 (there isn't any test case that covers this).

So the call to locimp_forLanguageTag() did more than previously
understood, but we still don't want to have to call that for every
language tag that has BCP-47 extensions just in order to get to this
special case. Instead, add a special case also to ulocimp_getSubtags().

For this to work nicely, the loop in _getVariant() that copies variants
needs to be refactored so that it easily can break when encountering the
start of any BCP-47 extension (which also has the welcome side-effect of
making it more efficient, being able to append an entire variant at once
to the output sink).

This was broken by commit 678d5c1273.
2025-02-13 08:50:17 +01:00
Frank Tang
de9910659d ICU-22661 Limit the size of variants in Locale
See #2821
2024-03-14 16:23:51 -07:00
Frank Tang
adb109f440 ICU-21749 Fix stack-use-after-scope bug in uloc
See #1858
2021-09-15 11:25:45 -07:00
luz paz
73eca0a9c9 ICU-21580 Fix typos in icu4c/
Found via `codespell -q 3 -L ans,anumber,atleast,ba,bre,hace,nd,nin,ois,rsource,som,sur,tht -S icu4c/source/data/zone,icu4c/source/data/lang`
ICU-21580 Fix source (related) typos
ICU-21580 Revert extraneous auto-encoding
ICU-21580 Re-add previous reverted fix without auto-encoding
2021-07-19 13:22:38 -05:00
Jeff Genovy
8082d0e145 ICU-21449 Infinite loop can occur with locale IDs that contain RES_PATH_SEPARATOR 2021-01-29 13:10:34 -08:00
Frank Tang
cde54fc5ba ICU-21157 Fix incorrect null termination.
See #1236
2020-08-20 16:22:34 -07:00
Erik Torres
a7a8cc3809 ICU-20808 Add test for the C locale to default to en_US_POSIX 2020-08-20 14:12:09 -07:00
Frank Tang
e395e8abcd ICU-21159 Document U_USING_DEFAULT_WARNING in .h
Document the fact
uloc_getDisplay(Language|Script|Country|Variant|Keyword|KeywordValue)
would fallback with the code, case canonicalied in same cases, and
set the status to U_USING_DEFAULT_WARNING.

No change to the implementation behavior. Only complete the missing
comments and tweak line wrap, remove double spaces and add test to
validate this pre-existing behavior that I added the documents now.
2020-08-17 15:18:01 -07:00
Frank Tang
0d4b1c1cb9 ICU-21160 Fix the length return by preflight
See #1178
2020-07-21 18:05:20 -07:00
Shane Carr
1d2861bb0c ICU-20627 Adding getAvailableLocalesByType, ICU4C and ICU4J. 2019-08-14 20:45:27 -07:00
Frank Tang
13b3cbaab7 ICU-20149 allow duplicate unicode attribute 2019-06-17 23:51:21 -07:00
Fredrik Roubert
59fe4f4be2 ICU-20132 Pass ByteSink from Locale::toLanguageTag() to uloc_toLanguageTag().
This eliminates the need for a scratch buffer in Locale::toLanguageTag()
and also the need for counting bytes required in uloc_toLanguageTag(),
something that ByteSink will now handle correctly and thereby
eliminating the bug where too few bytes required was returned.
2018-10-25 21:04:47 +02:00
Fredrik Roubert
10e79698d7 ICU-20228 Fix common typos for "language". 2018-10-24 20:54:10 +02:00
Jungshik Shin
c71a1b4b51
ICU-9562 Update language tag mapping per the latest IANA registry
uloc_forLanguageTag has a few mapping tables to map grandfathered
language tags and deprecated language subtags to their preferred or
modern values.

Update them based on the latest version of the IANA
language subtag registry. [1]

Five grandfathered tags without a preferred value are still mapped to
what ICU has mapped them to for backward compatibility until the
wisdom of continuing to do so is reviewed.

In addition, map redundant language tags to their preferred values
regardless of whether they're followed by other subtags or not. (e.g.
zh-yue vs zh-yue-u-co-pinyin) .

Similary, ja-latn-hepburn-heploc is mapped to ja-latn-alaic97 (the
variant subtag 'hepburn-helploc' with the prefix 'ja-latn' has the
preferred value, 'alaic97') .

Update the mapping for deprecated language subtags (e.g. 'jw' to
'jv' and a bunch of 3-letter language codes).

Add a new table for deprecated region subtags to map them to their
modern values. (e.g. 'DD' to 'DE').

Add a new test case for deprecated language and region mapping and
a few more cases for updated grandfathered and redundant tag mapping.

[1]
https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
2018-09-27 14:27:42 -07:00
Fredrik Roubert
acc3f65a87
ICU-13417 Replace fixed buffers in uloc_tag.cpp with CharString.
This gets rid of those fixed buffers that caused ICU-13417 to be filed
in the first place, those that prevent handling language tags with very
large amounts of keywords.

A number of fixed buffers will still remain in uloc_tag.cpp (and
elsewhere in the locale handling code) for the time being, but this
change is a necessary first step in cleaning up this code and will
alleviate the most pressing problem encountered by ICU4C users.

An off-by-one error in _getKeywords() caused uloc_canonicalize() to not
write out the final keyword value in case the result would fill up the
buffer exactly, resulting in U_STRING_NOT_TERMINATED_WARNING.
2018-09-27 14:27:41 -07:00
jungshik
4ed35d7bb5
ICU-20140 Allow duplicated keys in U-extension per RFC 6067 (#136)
* ICU-20140 Allow duplicated keys in U-extension per RFC 6067

RFC 6067 [1] does allow duplicate keywords, but ICU4C's
uloc_forLanguageCode rejects it as invalid.

Change it to accept duplicate keywords and honor only the
1st one while ignoring subsequent ones per RFC 6067.

[1] Unicode extension to BCP 47:
    https://tools.ietf.org/html/rfc6067

* ICU-20140 Add ICU4J test and tweak ICU4C test

ICU4J test diverges from ICU4C tests:

1. Handling of duplicate variants in ICU4J seem to be wrong:
   https://unicode-org.atlassian.net/browse/ICU-20148
2. ULocale.forLanguageTag only throws NullPointException so
   that ICU4C's test for duplicate attributes cannot be ported.
2018-09-27 14:27:40 -07:00
Andy Heninger
242e02c388 ICU-12764 icu4c utf-8 source files, update Copyright notices.
X-SVN-Rev: 39583
2017-01-20 00:20:31 +00:00
Michael Ow
61607c2773 ICU-12564 Update copyright notice in trunk
X-SVN-Rev: 38848
2016-06-15 18:58:17 +00:00
Yoshito Umaoka
00ca13e126 ICU-12564 Reverted r38761 and r38762, because we want to prepend the Unicode copyright for existing source files, instead of replacing copyright comments.
X-SVN-Rev: 38776
2016-05-31 21:45:07 +00:00
Michael Ow
c9f199a30f ICU-12564 Update copyright notice in ICU4C
X-SVN-Rev: 38761
2016-05-26 22:32:17 +00:00
Yoshito Umaoka
8885f1ef78 ICU-8951 BCP 47 key/type converter APIs merged from the work branch.
X-SVN-Rev: 36320
2014-09-03 04:42:21 +00:00
Yoshito Umaoka
557da151c7 ICU-9839 Punctuation exemplar type support. Code is added, but not working because of data problem explained in #9845. When data is refreshed next time, the problem should go away.
X-SVN-Rev: 33062
2013-01-18 16:29:02 +00:00
Doug Felt
809ac514dc ICU-7500 fix uloc_getDisplayName incorrect length
X-SVN-Rev: 27774
2010-03-04 02:34:15 +00:00
Yoshito Umaoka
6b1a0829a6 ICU-6434 ICU4C toLanguageTag/forLanguageTag implementation.
X-SVN-Rev: 25756
2009-04-10 22:30:39 +00:00
David Bertoni
5822580eca ICU-6124 Merged private branch into the trunk. Implementation complete, but waiting for new CLDR data.
X-SVN-Rev: 23960
2008-05-21 21:53:55 +00:00
David Bertoni
8ad2ddd4ca ICU-6228 C++ implementation complete.
X-SVN-Rev: 23897
2008-05-14 20:39:58 +00:00
Deborah Goldsmith
e7c563efb3 ICU-5627 Add uloc_getLocaleForLCID
X-SVN-Rev: 21579
2007-05-24 00:04:20 +00:00
George Rhoten
81b211ef90 ICU-4707 Fix some compiler warnings.
X-SVN-Rev: 19444
2006-03-26 00:18:23 +00:00
George Rhoten
8b6eb2b923 ICU-5032 Increase code coverage numbers by enabling a test.
X-SVN-Rev: 19081
2006-02-07 19:26:37 +00:00
Ram Viswanadha
7aaebd3ab7 ICU-4051 verify locale aliases
X-SVN-Rev: 18430
2005-08-12 22:01:55 +00:00
Steven R. Loomis
59ac27a504 ICU-3591 uloc_acceptLanguage tests
X-SVN-Rev: 16751
2004-11-04 08:17:26 +00:00
Deborah Goldsmith
95bbad7347 ICU-4115 Set warning code when falling back to parent or root
X-SVN-Rev: 16546
2004-10-18 23:59:41 +00:00
George Rhoten
08382a4b07 ICU-3938 Related to cldrbug 235.
Separate cldr tests from cloctst, and depend on testLocale instead of root for testing

X-SVN-Rev: 16253
2004-09-03 20:51:11 +00:00
Steven R. Loomis
9b4ae3bd1b ICU-3651 uloc_setKeywordValue (partial: need test for removal of keywords)
X-SVN-Rev: 16241
2004-09-01 02:25:14 +00:00
Eric Mader
c5705d3767 ICU-3770 Updated copyright notices for ICU 3.0
X-SVN-Rev: 15413
2004-05-19 21:19:13 +00:00
Alan Liu
8af4a86e25 ICU-2202 initial tests
X-SVN-Rev: 14374
2004-01-22 00:15:32 +00:00
George Rhoten
b9072652ab ICU-3222 Fix some compiler warnings.
X-SVN-Rev: 14308
2004-01-13 00:09:55 +00:00
Vladimir Weinstein
7a03a9daba ICU-2438 getBaseName test
X-SVN-Rev: 14279
2004-01-09 07:59:45 +00:00
Ram Viswanadha
eb684be491 ICU-2938 add tests for the newly added API
X-SVN-Rev: 13619
2003-11-07 02:48:11 +00:00
George Rhoten
09105d9c9a ICU-2942 Create uloc_canonicalize
X-SVN-Rev: 13528
2003-10-29 22:29:19 +00:00
Vladimir Weinstein
3d2215268d ICU-2438 uloc_getLocaleNoKeywords (for resource bundles), support for canonizing ICU variants to keywords (disabled).
X-SVN-Rev: 13473
2003-10-22 18:53:54 +00:00
Vladimir Weinstein
6edcd27333 ICU-2438 C++ tests for getKeywords and getKeywordValue
X-SVN-Rev: 13424
2003-10-15 05:32:40 +00:00
Vladimir Weinstein
847cec8661 ICU-2438 uloc_getKeywords, uloc_getKeywordValue tests
X-SVN-Rev: 13406
2003-10-14 06:08:54 +00:00
Markus Scherer
bbf546a40e ICU-2439 fix display name lookups to not fallback through the default locale
X-SVN-Rev: 11712
2003-04-25 22:56:51 +00:00
George Rhoten
18223f5083 ICU-1616 Fix some more of the Locale differences between countries.
X-SVN-Rev: 7629
2002-02-12 18:42:47 +00:00
George Rhoten
616ee23932 ICU-1616 Move the TestLocaleStructure test from crestest to cloctest
X-SVN-Rev: 7571
2002-02-05 23:47:41 +00:00
Steven R. Loomis
6222b1e2ba ICU-1276 updated ISO codes, 3->2 mapping, obsolete codes
X-SVN-Rev: 6234
2001-10-14 00:24:34 +00:00
Ram Viswanadha
ef97b534cd ICU-903 update copyright notices
X-SVN-Rev: 4233
2001-03-21 19:46:49 +00:00
Steven R. Loomis
900403dd5f ICU-860 tests for i-, x-, @, . locales and Locale::createFromName
X-SVN-Rev: 3668
2001-02-17 13:34:42 +00:00
George Rhoten
994d196cbb ICU-432 Fixed a very odd leak with cloctest, cucdtst and crestst
X-SVN-Rev: 3245
2000-12-15 19:16:43 +00:00