LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   change system language (https://www.linuxquestions.org/questions/linux-newbie-8/change-system-language-715978/)

murkis 04-01-2009 02:15 AM

change system language
 
Hello,

I have a java program that has to use specific character encoding (baltic 1257). When i run this program on a UTF debian system, i get hieroglyphs from this program's output. If i change the system language to the one i need (lt-LT) - it works fine, but the whole system changes to this language and i don't want that.

What i need to do is figure out a way (if such exists) to make this java process think that the system language is "lt-LT". Is this possible via some shell script or something like that?

And do not suggest to convert this program to UTF instead of ASCII, because for some specific reasons, windows-1257 is required.

bathory 04-01-2009 04:27 AM

Use
Code:

export LANG=lt_LT
before running the java app and see if it works

murkis 04-01-2009 05:30 AM

Thanks, i'll try that as soon as i can. Are there any other env variables that affect the language that could be exported?

theYinYeti 04-01-2009 06:34 AM

I wish I knew the answer. I have this problem that sed fails on ISO-8859-1 content, so I have to run a pipe: iconv | sed | iconv. Example:
Code:

[yves@localhost java]$ echo $LANG
fr_FR.UTF-8
[yves@localhost java]$ sed -n '/è/p' log
[yves@localhost java]$ LANG=fr_FR sed -n '/è/p' log
[yves@localhost java]$ iconv -f ISO-8859-1 -t UTF-8 <log | sed -n '/è/p' | iconv -f UTF-8 -t ISO-8859-1
Probl�me de class loader
[yves@localhost java]$ iconv -f ISO-8859-1 -t UTF-8 <log | sed -n '/è/p'
Problème de class loader

This cannot always be done. Especially when dealing with several files.

Still, maybe the same can be done with java: java … | iconv -f UTF-8 -t lt_LT

Yves.

bathory 04-01-2009 06:35 AM

You can run
Code:

locale
to see all the relevant env. variables, but the only one that really matters in you case in LANG. If you have to use accented characters, then you might need to change also LC_CTYPE.


All times are GMT -5. The time now is 06:47 AM.