LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-01-2009, 03:15 AM   #1
murkis
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
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.
 
Old 04-01-2009, 05:27 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,602

Rep: Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532
Use
Code:
export LANG=lt_LT
before running the java app and see if it works
 
Old 04-01-2009, 06:30 AM   #3
murkis
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, i'll try that as soon as i can. Are there any other env variables that affect the language that could be exported?
 
Old 04-01-2009, 07:34 AM   #4
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
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.
 
Old 04-01-2009, 07:35 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,602

Rep: Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change the system language in SYSLinux: jazzguyman Linux - Distributions 2 12-16-2010 12:36 PM
change system language for apache to german xxxx Debian 1 08-08-2007 10:43 PM
How to change the language ? wlaw Linux - Newbie 1 09-21-2004 09:46 PM
how to change the default language of the system icoming Linux - General 8 06-01-2004 02:06 PM
under kde3 i change change language, where in gnome? sirpelidor Mandriva 1 12-10-2003 05:39 PM


All times are GMT -5. The time now is 04:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration