| | |
Views and Suggestions on Unicode
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
Hello,
I just discovered that we can use unicode anywhere in the program.
EG : \u0061 = 'a' .. \u005B = '[' .. \u005D = ']'
This program will execute fine without any errors.
But what i want to know is, Whats the benefit of using unicode in program ?
Waiting for your views and suggestions.
Regards,
I just discovered that we can use unicode anywhere in the program.
EG :
java Syntax (Toggle Plain Text)
public class CheckUnicode { public static void m\u0061in(String\u005B\u005D args) { System.out.println("Hello World!"); } }
This program will execute fine without any errors.
But what i want to know is, Whats the benefit of using unicode in program ?
Waiting for your views and suggestions.
Regards,
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
You may need unicode to print characters that are not supported. Like having an application that needs to print messages in various languages (English, German, Chinese) depending on user's selection.
It is used for internationalization. In one of my projects we had different property files used for resource bundles to print messages in different languages. For languages like English, French we had normal characters, but for Chinese and others we used unicode.
Unicode is also used for printing unsupported characters in HTML pages
But even if you can use it for declaring methods, you shouldn't. It is better to declare methods and variables with English characters and English descriptions since it may be read by others.
Meaning that you should name a method like:
> getNumberOfUsers
but not:
> epestrepseArithmoChriston
The later translates to the first method but you shouldn't name methods using your native language with english characters. Someone else might want to read the code.
It happened to me where we had to debug an entire application written in Italian. Not a clue what was going on. Babel Fish became my best friend
It is used for internationalization. In one of my projects we had different property files used for resource bundles to print messages in different languages. For languages like English, French we had normal characters, but for Chinese and others we used unicode.
Unicode is also used for printing unsupported characters in HTML pages
But even if you can use it for declaring methods, you shouldn't. It is better to declare methods and variables with English characters and English descriptions since it may be read by others.
Meaning that you should name a method like:
> getNumberOfUsers
but not:
> epestrepseArithmoChriston
The later translates to the first method but you shouldn't name methods using your native language with english characters. Someone else might want to read the code.
It happened to me where we had to debug an entire application written in Italian. Not a clue what was going on. Babel Fish became my best friend
Last edited by javaAddict; Jun 15th, 2009 at 6:46 am.
Check out my New Bike at my Public Profile at the "About Me" tab
The ability to use any character regardless of the current system character set.
Be careful though. Unicode is translated as the first step in compilation, so you might wind up with some unforeseen complications.
See http://en.wikibooks.org/wiki/Programming:Java_Comments
Be careful though. Unicode is translated as the first step in compilation, so you might wind up with some unforeseen complications.
See http://en.wikibooks.org/wiki/Programming:Java_Comments
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Thanks for reply,
Ok, Got it.
So can we say, we use unicode in comments, method names and variable names to create a better documentation in native languages?
Or is there any other reason too ?
Ok, Got it.
So can we say, we use unicode in comments, method names and variable names to create a better documentation in native languages?
Or is there any other reason too ?
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
•
•
•
•
But even if you can use it for declaring methods, you shouldn't. It is better to declare methods and variables with English characters and English descriptions since it may be read by others.
You use unicode for unsupported characters. If your keyboard has the 'a' then use it for the name of your method. What's the point to use unicode then
Check out my New Bike at my Public Profile at the "About Me" tab
•
•
•
•
No you shouldn't use unicode for declaring methods and variables.
You use unicode for unsupported characters. If your keyboard has the 'a' then use it for the name of your method. What's the point to use unicode then
Thanks for help!
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
Actually what I said is what I believe to be best practice. In general, you can do whatever you want.
But I doubt if anyone will write an entire application using only unicode. Can you imagine?
But I doubt if anyone will write an entire application using only unicode. Can you imagine?
Check out my New Bike at my Public Profile at the "About Me" tab
•
•
•
•
Actually what I said is what I believe to be best practice. In general, you can do whatever you want.
But I doubt if anyone will write an entire application using only unicode. Can you imagine?
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
•
•
Actually what I said is what I believe to be best practice. In general, you can do whatever you want.
But I doubt if anyone will write an entire application using only unicode. Can you imagine?
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
![]() |
Similar Threads
- How to get backlinks increased (Search Engine Optimization)
- Writing Unicode to Oracle (Oracle)
- Unicode - character printing probelm (Java)
- Storing Views and File information (ASP.NET)
- Vista Installation Nightmare- UPDATE!! (Windows Vista and Windows 7)
- Delphi Unicode/RTF Question (Pascal and Delphi)
- Career in IT Security or IT E-Commerce? (IT Professionals' Lounge)
- Please Review Wodiak.com (Website Reviews)
- Encoding (Unicode) problem in IE 6.0 (Web Browsers)
Other Threads in the Java Forum
| Thread Tools | Search this Thread |
android api applet application array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) chat class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse editor error errors event eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle parsing plazmic print problem program programming project recursion scanner screen server set sharepoint size smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads time tree unlimited utility webservices windows






