Skip to content

Pb with user language and country setting + File encoding #217

@neoludo

Description

@neoludo

Hi,

I have a different behaviour from standard openjdk image, on i18n settings and file encoding.
On openjdk images, if I put these environment variables :
CHARSET=UTF-8
LANGUAGE=fr_CH.UTF-8
LANG=fr_CH.UTF-8
LC_ALL=fr_CH.UTF-8

And execute :

    System.out.println(Charset.defaultCharset());
    System.out.println("Locale.getDefault() 		--> "+Locale.getDefault());
    System.out.println("toString() 			--> "+new Date());
    DateFormat format = new SimpleDateFormat("EEE dd MM yyyy ',' HH:mm:ss z");
    System.out.println("SimpleDateFormat.format() 	--> "+format.format(new Date()));

    NumberFormat numberFormat = NumberFormat.getCurrencyInstance();
    System.out.println("NumberFormat.format() 		--> "+numberFormat.format(100L));
    System.out.println("NumberFormat.format() 		--> "+numberFormat.format(10000L));
    System.out.println("NumberFormat.format() 		--> "+numberFormat.format(10000.25));
    System.out.println("NumberFormat.format() 		--> "+numberFormat.format(10000.25698));

I have expected behaviour : UTF8 and correct data and currency formatting corresponding to fr_CH.

With adoptopenjdk image, environment variable seems to be ignored and I have to add explicitly as System properties : -Duser.language=fr -Duser.country=CH -Dfile.encoding=UTF-8

As openjdk in your image is not installed using apk package, maybe one step is missing.

Thanks in advance for your help.
Ludovic

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions