2

My web app runs fine after I changed the system locale however whenever files are generated (java.text.numberformat.getCurrencyInstance() ) the currency shown in the files are in $ as opposed to € which is the currency for the system locale. The web application doesn't have a problem displaying the right currency though. The system is a remote ubuntu 10.10 server. I have exhhausted every system locale setting possibility and after multiple restarts I am still nowhere close to the answer. [Edit] I have tried the following:

https://askubuntu.com/questions/89976/how-to-change-the-default-locale-in-ubuntu-10-10-server when the problem initially appeared which solved the display issues.

I have purged all other locales except french using localepurge.

I have edited the /etc/default/locale to contain the following:

LANG=fr_FR.UTF-8
LANGUAGE=fr_FR
LC_CTYPE=fr_FR.UTF-8
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE=fr_FR.UTF-8
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES=fr_FR.UTF-8
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=
Community
  • 1
  • 1
Dark Star1
  • 6,986
  • 16
  • 73
  • 121
  • Listing what you've already tried might prevent useless answers and encourage new suggestions. Have you seen this blog post: http://blog.andrewbeacock.com/2007/01/how-to-change-your-default-locale-on.html – Michael Borgwardt Jan 19 '12 at 23:59

1 Answers1

1

Even if your remote system have locale set to X, and you connect from remote host with locale set to Y your locale (Y) can be magically transferred to remote system for the current session (like TERM is).

see SendEnv LANG LC_* in man ssh_config.

So, your remote java app, may get different locale settings depending of how you start it. If it gets started as a system service after reboot on host A, it will get it's natural locale settings on host A (LANG="C"), but if you login from another host B via ssh, with different locale settings (LANG="pl_PL" on host B) the java app started from that ssh session on host A may get (depending on ssh configuration) locale settings from host B.

 _______________                         ______________
[ remote host A ]                       [ local host B ]
[ LANG="C"      ]  - - - - [ssh]- - - - [ LANG="pl_PL" ]
[ java app      ]                       [ xterm        ]
[_______________]                       [______________]
Michał Šrajer
  • 30,364
  • 7
  • 62
  • 85
  • The web app gets start on the remote host on startup. and all connections to it are via a web browser. Also please keep in mind that the web app actually displays everything on the web pages in the correct locale it's just that when it comes to the generation of PDF files all currency formats are in $. – Dark Star1 Jan 20 '12 at 00:22