Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-13-2008, 09:52 AM   #1
LQ Newbie
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
Utf-8 command line parameters

I have written a Java application that is supposed to run in text mode. It gets command line parameters like java -jar my.jar -param par1

Sometimes it is needed to get a UTF-8 characters passed as parameter, like diacritical characters used in eastern european languages such as × or something like that. It works without any problems on Windows command line console, I type the parameter and it is read incorrect way. The problem occurs when I use console in Linux where, although I type using putty client letter and the characted is not read correctly. An output from my program returns the bad parameter and prints it like

Instead of ×test like it is typed in command line.

Am I doing something wrong or is something supposed to be done on the system level in order to make this work?

Thanks a lot.
Old 03-14-2008, 09:10 AM   #2
Registered: Jun 2005
Posts: 445

Rep: Reputation: 31
I don't know what you use in your code to read from the console, but make sure you have not set it to eastern european charset. Windows will use the local Windows codepage on the console, which can vary following the language used! I don't know eastern european characters enough to tell you if UTF8 charset is interpreted as cp125x or if UTF8 is expected and you use cp125x as charset in your case. That would be a good starting point. Create a text file in Windows eastern european encoding (cp125x) and open it with a Linux text editor which lets you change the encodings, KWrite for example. Then see how you can reproduce the garbled characters. Welcome in the codepage hell

EDIT: I see you are using putty. Might this be the problem? I don't know what you are doing with putty exactly.

Last edited by hansalfredche; 03-14-2008 at 09:15 AM.


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
BASH: read every line in the files and use the line as parameters as another program tam3c36 Programming 10 12-07-2010 01:42 PM
xine command line? or some other command line only engine? lumix Linux - Software 2 08-10-2007 10:46 AM
im getting UTF-8 to STRING: Could not open converter from 'UTF-8' to 'ISO-8859-1' jabka Linux - Newbie 2 11-24-2006 05:44 AM
[Enter] in text documents diffrent on Windows and Linux? UTF-8/UTF-16 problem or? brynjarh Linux - General 1 11-24-2004 05:20 AM
X11 / UTF-8 locale seems missing 'fr_FR.UTF-8' chrsitophermann Debian 11 07-17-2004 02:04 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:29 PM.

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