Results 1 to 13 of 13
Thread: russian character issue
- 04-01-2011, 11:37 AM #1
Member
- Join Date
- May 2010
- Posts
- 90
- Rep Power
- 0
russian character issue
hi friends,
i have a java code which just print russian character string to console.
program is as below
but it fails on compiling.Java Code:class A { public static void main(String ... args) { System.out.print("FДКЗ CУЯILLIC GЗИЗЯДTФЯ "); } }
can anyone say whats happening in it?
how can i use russian character in java?
thanks in advance......
- 04-01-2011, 11:39 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
IF you are fails in compile, there should be an error message. What was that?
- 04-01-2011, 11:43 AM #3
Hi, First you have mistake in main methods. Second, You need just set special encoding for output. looks like.
Java Code:public class RusOut { public static void main(String[] arg) { System.setProperty("console.encoding","Cp866"); System.out.println("Привет из России! :)"); } }Last edited by Petr; 04-01-2011 at 11:46 AM.
Skype: petrarsentev
http://TrackStudio.com
- 04-01-2011, 11:51 AM #4
- 04-01-2011, 11:55 AM #5
Oh Sorry it's OK. This construction for main method with varargs looks strange for me. Sorry it's my mistake :)
Skype: petrarsentev
http://TrackStudio.com
- 04-01-2011, 12:07 PM #6
Ah ok. I thought you might have spotted something I didn't.
db
- 04-01-2011, 12:12 PM #7
Member
- Join Date
- May 2010
- Posts
- 90
- Rep Power
- 0
thank you all for quick reply.
but i cant save my java file when it contains russian characters.
i am using notepad in windows, and it ask me to save using unicode encoding.
when i save it using unicode javac command produce much errors....
- 04-01-2011, 12:34 PM #8
Notepad introduces a BOM (byte order mark) at the beginning of the file. Use a proper code editor, or open the file with a hex editor and remove the first 3 (?) characters after saving it in Notepad.
You should copy and paste those errors here, so that members trying to help don't have to guess.javac command produce much errors....
db
- 04-01-2011, 12:52 PM #9
Member
- Join Date
- May 2010
- Posts
- 90
- Rep Power
- 0
i have made a small change in my program.
i saved my russian string in a txt file and tried to read it from my java code
but it produceJava Code:import java.util.*; import java.io.*; class a { public static void main(String ... args) { System.setProperty("console.encoding","Cp866"); try { FileInputStream fr = new FileInputStream ("a.txt"); InputStreamReader ir= new InputStreamReader(fr , "Cp866"); BufferedReader br = new BufferedReader (ir); String line; while ((line = br.readLine()) !=null) { System.out.println(line); } } catch (Exception e) {} } }
▼♦@♦8♦2♦5♦B♦ 8♦7♦ ♦>♦A♦A♦8♦8♦! as output
- 04-01-2011, 01:21 PM #10
- 04-01-2011, 01:44 PM #11
Member
- Join Date
- May 2010
- Posts
- 90
- Rep Power
- 0
no change on adding ISO-8859-5
- 04-01-2011, 01:45 PM #12
Member
- Join Date
- May 2010
- Posts
- 90
- Rep Power
- 0
peter i tried "windows-1251" but same result
- 04-01-2011, 03:52 PM #13
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,375
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
How to search russian texts in Lucene index?
By ArtUrlWWW in forum LuceneReplies: 0Last Post: 01-11-2011, 11:46 AM -
Replace Text (Russian & Swedish), Add Header & Footer in Pdf Docs
By sherazam in forum Java SoftwareReplies: 0Last Post: 10-12-2010, 09:09 AM -
how do java handle russian characters=unicode in Files&Streams code?
By lse123 in forum Advanced JavaReplies: 23Last Post: 08-12-2010, 09:59 AM -
querying russian data from db problem
By mr_empty in forum JDBCReplies: 0Last Post: 03-04-2008, 07:56 AM -
reading text character by character
By bugger in forum New To JavaReplies: 2Last Post: 11-09-2007, 08:54 PM


LinkBack URL
About LinkBacks


Bookmarks