docker-alpine-java icon indicating copy to clipboard operation
docker-alpine-java copied to clipboard

Trouble with locale

Open natewarr opened this issue 8 years ago • 5 comments

When building this image, locale def returns this to stderr:

LC_MONETARY: value of field int_curr_symbol' has wrong length No definition for LC_PAPER category found No definition for LC_NAME category found No definition for LC_ADDRESS category found No definition for LC_TELEPHONE category found No definition for LC_MEASUREMENT category found No definition for LC_IDENTIFICATION category found`

This line of code running from within the JVM fails to format the number with a dollar sign, as expected:

BigDecimal subTotalAmount = 1.00
NumberFormat.getCurrencyInstance(Locale.US).format(subTotalAmount)

If I run this same code with LANG=C (the alpine default), the number works correctly.

natewarr avatar Sep 02 '16 15:09 natewarr

Thanks for the report and example, will take a look

On Fri, Sep 2, 2016, 08:45 Nathan Warren [email protected] wrote:

When building this image, locale def returns this to stderr:

LC_MONETARY: value of field `int_curr_symbol' has wrong length No definition for LC_PAPER category found No definition for LC_NAME category found No definition for LC_ADDRESS category found No definition for LC_TELEPHONE category found No definition for LC_MEASUREMENT category found No definition for LC_IDENTIFICATION category found

This line of code running from within the JVM fails to format the number with a dollar sign, as expected:

BigDecimal subTotalAmount = 1.00 NumberFormat.getCurrencyInstance(Locale.US).format(subTotalAmount)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/anapsix/docker-alpine-java/issues/21, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMrB_5jwtSbux6jSHAjInv1Fdm0E15hks5qmESmgaJpZM4Jz1mP .

anapsix avatar Sep 05 '16 04:09 anapsix

I think, I've fixed it in the fixing_jce branch. Do you mind giving it a try @natewarr?

anapsix avatar Sep 09 '16 19:09 anapsix

No change in functionality for me. When I set LANG=C back, my build/tests ran successfully.

natewarr avatar Sep 13 '16 15:09 natewarr

We ended up having to do something similar. The following lines were added to the Dockerfile (which may not be relevant for all users), such that Java could reference the correct LANG.

Set the locale

ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8

The image we used was the following:

anapsix/alpine-java 8_server-jre_unlimited 9534edbd085f 5 weeks ago 125.2 MB

nateww avatar Sep 13 '16 18:09 nateww

ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 Why did I fail to set it up like this?

wuxufeng2 avatar Mar 05 '19 12:03 wuxufeng2