DHAMIN
asked on
Have to print russian language data in JAVA
I get the russian language data from the database adn I am able to view the proper data in my debugger. But when I try to use System.out.println to print the data to check, I am getting everything ???????????. I don't know how to solve this. I am using struts and I don't know what encoding/decoding have they done in the database.
Thanks,
Thanks,
Your console probably doesn't support what you're attempting to do. Are you using Windows?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes. I am using Windows.
ASKER
When I tried to check the encoding by using your above code, it returns me Cp1252
Yes, that's all default. It's going to be a lot easier for you to view Russian output in an IDE console. Can you arrange it that way?
ASKER
Yes. I am trying to print the russian data to my console and I using IntellIJ. Thats when it is printing the ????.
You need to use an encoding that supports Russian. In this case, for your debugging purposes, try setting your IDE with
-Dfile.encoding=UTF-8
-Dfile.encoding=UTF-8
ASKER
It is already been set as UTF-8 only.
You will of course need Russian font support
ASKER
Yes. But how will I get that?
ASKER
But I am using windows 7.
But did you do necessary setup in Control Panel?
Don't know exactly in Windows7 but in XP you go to Control Panel, Reginal and Language,
Languge - Details - Advanced - Add, and find Russian
Can you see Russian say in Windows Word?
I have IntelliJ and I can see and type Russian within it
Don't know exactly in Windows7 but in XP you go to Control Panel, Reginal and Language,
Languge - Details - Advanced - Add, and find Russian
Can you see Russian say in Windows Word?
I have IntelliJ and I can see and type Russian within it
No, sorry, I was wrong - read the trail more attentively - I can type Russian in IntelliJIdea,
but System.out.println indeed prints ????
but System.out.println indeed prints ????
In Idea go to Settings | File Encodings and change it to UTF-8.
You don't need to add -Dfile.encoding=UTF-8 to runtime JVM - IDEA adds this automatically
Try to change in Settings | File Encodings - it started working for me
when I did it.
ASKER
Already the encoding is in UTF-8. But it is still printing ?????.
You probably don't have Russian font support. Try changing the font
Which version of Idea are you using? What Java version?
Fiirst try to create very simple brand new project and set File Encoding to UTF-8 - I also
had some problems but eventually this worked for me, so it probably should work for you.
I have XP rather than Winndows 7, but other than that it is the same.
Fiirst try to create very simple brand new project and set File Encoding to UTF-8 - I also
had some problems but eventually this worked for me, so it probably should work for you.
I have XP rather than Winndows 7, but other than that it is the same.
No you have Russian font as you are typing in Russina in the editor window - correct?
Check http://technojeeves.com/joomla/index.php/free/103-can-character-be-displayed-in-java for determining Russian character support
This is rather Idea issue, not general Java -
I just had it System.out.println(russin text here) - and when I changed this Setting | File Encoding
it started working for me - I'm sure it should work for you
I have version 9.0.1 of Idea, but I'm pretty sure it should be the same
on previouis versions.
can you see Russian in say Word for Windows on your computer?
But I think once you can see it in the editor window of Idea, it should also work in System.out.print
with this setting
I just had it System.out.println(russin text here) - and when I changed this Setting | File Encoding
it started working for me - I'm sure it should work for you
I have version 9.0.1 of Idea, but I'm pretty sure it should be the same
on previouis versions.
can you see Russian in say Word for Windows on your computer?
But I think once you can see it in the editor window of Idea, it should also work in System.out.print
with this setting
I attach a very simple project created by Idea 9 - if you have 9 or 10 - it should work
for you. Just rename the RussianPrintout2.txt to RussianPrintout2.iml
and the folder "idea" to ".idea" (dot should be the first character),
as EE do not allow to upload .iml files and foleders starting with dot
I guess if it works for me and prints in Russian, why shouldn't it work for you
RussianPrintout2.zip
for you. Just rename the RussianPrintout2.txt to RussianPrintout2.iml
and the folder "idea" to ".idea" (dot should be the first character),
as EE do not allow to upload .iml files and foleders starting with dot
I guess if it works for me and prints in Russian, why shouldn't it work for you
RussianPrintout2.zip
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.