LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 03-13-2008, 10:52 AM   #1
mik2709
LQ Newbie
 
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
Utf-8 command line parameters


Hello!
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
�test

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, 10:10 AM   #2
hansalfredche
Member
 
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 10:15 AM.
 
  


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
BASH: read every line in the files and use the line as parameters as another program tam3c36 Programming 10 12-07-2010 02:42 PM
xine command line? or some other command line only engine? lumix Linux - Software 2 08-10-2007 11: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 06:44 AM
[Enter] in text documents diffrent on Windows and Linux? UTF-8/UTF-16 problem or? brynjarh Linux - General 1 11-24-2004 06:20 AM
X11 / UTF-8 locale seems missing 'fr_FR.UTF-8' chrsitophermann Debian 11 07-17-2004 03:04 PM


All times are GMT -5. The time now is 11:09 AM.

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