Skip to content
Commit 788cb18f authored by Neil Fuller's avatar Neil Fuller
Browse files

Fixing android.text.format.Time for non-English locales

The test fixes for bug 17262063 showed up a real issue for
non-English locales with the Time.format() method:
If the Android string resources that contain the pattern use
non-ASCII characters then a '?' would be output instead of
those characters.

For example, in France the pattern for '%c' includes a 'à'
(a with a grave accent) and Japan includes 日.

The problem was due to converting the pattern to bytes using
the US_ASCII character set, which turns non-ASCII characters
into '?'. The code has been changed to use char throughout
and avoid bytes.

Internal documentation has been improved.

Some calls to modifyAndAppend() have been replaced with a
direct call to outputBuilder.append() because the
modify step is guaranteed to a no-op for the literals given.

The formatter has been changed to use Locale.US because it
is only used for outputting numbers. It has been renamed
to make this more obvious and the locale field has been
removed.

Bug: 17262063
Change-Id: I32b92f7f7e3e6931d3514d87f1d9a38f136d4021
parent 7a16ffe2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment