| | |
Need help on Unicode (GURMUKHI) in java
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
Hello everyone,
Im trying to write Punjabi (Gurmukhi) by Unicode. I have the Unicode code point of all character and Code Block is Gurmukhi.
u0A73 = GURMUKHI URA = ੳ
but its showing "?".
then i tried with PrintStream
now its showing "ੳ".
Tried with UTF-16 and UTF-32 too.
so, i decided to post here for help. can anyone help me to sort out this problem ?
Thanks in advance.
Im trying to write Punjabi (Gurmukhi) by Unicode. I have the Unicode code point of all character and Code Block is Gurmukhi.
java Syntax (Toggle Plain Text)
System.out.prinln("\u0A73")
but its showing "?".
then i tried with PrintStream
java Syntax (Toggle Plain Text)
String unicodeMessage = "\u0A73"; try { PrintStream output = new PrintStream(System.out, true, "UTF-8"); output.print(unicodeMessage); } catch (UnsupportedEncodingException e) { e.printStackTrace(); }
Tried with UTF-16 and UTF-32 too.
so, i decided to post here for help. can anyone help me to sort out this problem ?
Thanks in advance.
Last edited by puneetkay; Dec 11th, 2008 at 9:56 am.
Puneet Kalra
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
There is as such no problem with your code; IMO the fault lies with the incompetence of the shell to render fonts correctly. I assume you are on a windows box? Anyways, this is just a rendering issue. Maybe a little more background on what you are trying to achieve here would be required to offer some advice.
Anyways, to mess around with code points and to get a feel of how the characters looks, try this sample snippet which creates an HTML document 'test.html'. The gurmukhi characters are displayed correctly since I guess browsers have their own font rendering engine.
Anyways, to mess around with code points and to get a feel of how the characters looks, try this sample snippet which creates an HTML document 'test.html'.
Java Syntax (Toggle Plain Text)
// Error handling and best practices omitted for brevity public class HtmlTester { private final static String HTML = "<html><head><META HTTP-EQUIV=\"Content-Type\" " + "CONTENT=\"text/html; charset=UTF-8\"></head><body><div>{0}" + "</div></body></html>"; public static void main(final String[] args) throws Exception { testIt(); } public static void testIt() throws Exception { String toWrite = MessageFormat. format(HTML, String.valueOf("\u0A72 \u0A73 \u0A74")); writeData(toWrite, new File("test.html")); } public static void writeData(String s, File f) { try { BufferedWriter out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(f), "utf-8")); out.write(s); out.flush(); out.close(); } catch(Exception e) { e.printStackTrace(); } } }
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Hello,
Thanks for reply,
Actually, im creating a virtual Punjabi keyboard. On swing components, I used setFont() method and working perfectly. But i also need to display it on Console.
Im using Windows Vista and Eclipse IDE.
Im still on it, hope to the solution soon.
Thanks again!
Thanks for reply,
Actually, im creating a virtual Punjabi keyboard. On swing components, I used setFont() method and working perfectly. But i also need to display it on Console.
Im using Windows Vista and Eclipse IDE.
Im still on it, hope to the solution soon.
Thanks again!
Puneet Kalra
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
If you plan on viewing the output on Eclipses's console, it shouldn't be that big a problem. Try following the advice in this post.
But if you are stuck with windows console, then there isn't a reliable / sure shot way of getting it to work. Many have suggested setting the code page to 65001 though I am not very sure whether it works in all cases.
Let me know if the above suggested fixes work in your case. Best of luck for your project; hoping to see it on sourceforge. ;-)
But if you are stuck with windows console, then there isn't a reliable / sure shot way of getting it to work. Many have suggested setting the code page to 65001 though I am not very sure whether it works in all cases.
Let me know if the above suggested fixes work in your case. Best of luck for your project; hoping to see it on sourceforge. ;-)
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Hie again,
It works! Thanks
Yea sure, I will surely post it on SourceForge
Thanks again!
It works! Thanks
Yea sure, I will surely post it on SourceForge
Thanks again!
Puneet Kalra
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
So, were you trying it on Eclipse or windows console? BTW, bump this thread when your project is completed. :-)
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Puneet Kalra
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
I meant post a reply here once it is completed and up on sourceforge, so that I can get a notification; it might interest the kids new to Java.
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Puneet Kalra
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
![]() |
Other Threads in the Java Forum
- Previous Thread: How do I concatenate this string
- Next Thread: where to find the source codes...
| Thread Tools | Search this Thread |
Tag cloud for Java
android api apple applet application apps arguments array arrays automation balls binary bluetooth card chat class classes client code component consumer database draw eclipse ee error event exception file fractal free game gameprogramming gis givemetehcodez graphics gui helpwithhomework html ide image input integer j2me j2seprojects java javaprojects jmf jni jpanel julia jvm key linux list loop machine map method methods migrate mobile mobiledevelopmentcreatejar netbeans newbie nextline nls notdisplaying number oracle output print problem program programming project recursion recursive scanner screen security server set size sms socket sort spamblocker sql sqlite string sun swing terminal test threads time tree trolltech windows






