how to deal with hindi lang
I am storing text messages in a PropertyResourceBundle as follows
txt_EmailAdd = {mel ADres
txt_Password = pasvDR
I made the above file in MSword using hindi fonts
The folllowing text is supposed to be in hindi
{mel ADres
pasvDR
but it does not show the text in hindi it still shows in English but when I open the above text file in MSword it shows the text in hindi
Please tell me how to deal with this problem . I hope you people reply as eaarly as possible.
I also have another prob, I am developing a website using jsp+servlet now I have made the above mentioned property file and stored it in c:\tomcat5.0\webapps\emailreadersevice\IndexMessagesBundle.properties
but when I access it from my application's index.jsp file Tomcat gives me following exception
java.lang.NullPointerException
java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:714)
java.util.ResourceBundle.getBundle(ResourceBundle.java:579)
org.apache.jsp.index_jsp._jspService(index_jsp.java:55)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
My index.jsp file is stored in c:\tomcat5.0\webapps\emailreaderservice\index.jsp
In my index.jsp file i have written the following statement to get the IndexMessagesBundle but tomcat gives me the above exception.
ResourceBundle IndexMessages = ResourceBundle.getBundle("IndexMessagesBundle",currentLocale);
Please guide me abt how to go abt it. Also tell me whether I am doing the right thing or not. If no then please tell me the right steps to follow
A couple of things:
1. I recommend against using MS Word to create strings that go into your properties files. Word is prone to use special formatting etc. that can wreak havoc on your content (this may not be the cause here, just a general warning).
2. Did you run native2ascii against your Hindi properties file? If not, you need to do that (comes with the JDK - do a Google search to find syntax and function).
3. For your JSP/servlet, the resourcebundle needs to be in the WEB-INF/classes directory
Hi one_dane,
Thanks for the reply...............I moved the property file to WEB-INF/classes dir and it works no more exceptions
But when I run native2ascii against my property file it gives me following out put.
\u00ff\u00fet x t _ E m a i l A d d = { m e l A D r e s
t x t _ P a s s w d = p a s v D R
As mentioned in my previous post I have made my property file using hindi fonts
The following two lines are supposed to be in Hindi but it still shws it in English only.
In my browser also when I run it shows the txt_passwd's value as pasvDR and txt_EmailAdd's value as {melADres
the code in my jsp file is as shown below:
<%=IndexMessages.getString(txt_EmaiAdd)%>
and
<%=IndexMessages.getString(txt_Passwd)%>
I am very confused and am trying for long please somebody help me as soon as possible
once again thanks one_dane
Thanking you
Sincerely
Heti Shah
I am not sure what it is you are saying.
You say that the output of native2ascii is:
\u00ff\u00fet x t _ E m a i l A d d = { m e l A D r e s
t x t _ P a s s w d = p a s v D R
and that you get the values displayed above in your browser. If that is the content of your properties file, isn't that what you would expect to see?
I, on the other hand, would expect to see some Hindi text (I had assumed that the values you initially posted were some kind of placeholders).
For instance, in my Hindi properties file I have output like this:
title=\u090f\u0926\u0938\u093e \u092a\u0917\u0932\u094d\u0917 \u0942\u093e\u0902\u0942JSP i18n issues
(I apologize if the text says something rude in Hindi, I just typed in random Hindi characters to get my sample). And when I run my application in a Hindi locale, I get the correct Hindi text displayed:
title=एदसा पगल्ग ूांूJSP i18n issues
Hi one_dane
I have made the property file using hindi fonts to type the following thing
{ m e l A D r e s
p a s v D R
No the above values are not place holders Infact in order to type EmailAddress and Password in hindi I had to type the above keys. so when I put system.out.println in my jsp page it does not display any hindi text but the above keys which i used to type in order to display hindi text in my txt file.
But I think i am not going on the right track should i type the unicode values for hindi text which is of the form \udddd in my property file. I have the unicode chart for hindi fonts so I can look up the chart and type appropriate unicodes(\udddd) to display Email Address and Password in hindi. Or am i still not getting how to do it? If not then please tell me how did you create your hindi property file. Is the following that you typed in your property file or is it the output of converting your property file into unicode using native2ascii
title=\u090f\u0926\u0938\u093e \u092a\u0917\u0932\u094d\u0917 \u0942\u093e\u0902\u0942JSP i18n issues
Please reply as soon as possible and hanks a lot for your help.
Eagerly waiting for a reply,
Heti shah
Your properties file should contain the Hindi text. You need to use a text editor that will accept Hindi input and then save the file in an appropriate encoding. I recommend UTF-8. Then run native2ascii against that file.
title=\u090f\u0926\u0938\u093e \u092a\u0917\u0932\u094d\u0917 \u0942\u093e\u0902\u0942JSP i18n issues
is the content of my file after I run native2ascii against it.
title=एदसा पगल्ग ूांूJSP i18n issues
is the content if my file (UTF-8 encoding) before I run native2ascii against it.
I assume you have actual Hindi text already, otherwise there is no point in trying to create an application that can display Hindi.
Just to make it crystal clear: it does not matter which keys you use to produce the characters. What matters is the actual code points stored - since they obviously determine what is displayed. If you do not have code points that correspond to Hindi characters, then don't expect to see Hindi.
I would recommend that you read up on items such as code points, keyboard input and keyboard mapping, since your posts seem to indicate a basic lack of understaning of these areas.
Your references to Hindi fonts and the fact that you say you "see Hindi" when you view the characters in your file seems to indicate that you use some kind of proprietary font mapping rather than the actual Unicode values.
Hi One_Dane
I'm trying to bring a hindi text from one jsp to another. As i've installed all the IME n stuff, I'm able to get the display in hindi whenever i'm typing something in my textbox . But the same text is not displayed in hindi when i'm doing a request.getParameter() on that textbox.
I tried printing the UTF-8 unicode charsets like
"\\u0904\\u0904\\u0904". This does print fine. I can see the hindi appearing in these kinds of text. Also i tried out converting them to code points n stuff, and it works fine. Infact all the values that are not coming up from the request parameter are working fine.
So i concluded that in the previous page where-in i'm giving the inputs, probably they might not be wrapped up in the UTF-8 charset. But i've specified the charsets to be UTF-8 in the meta info for both the pages.
Kindly help regarding what might be the issue. Please tell if i missed out any point while explaning.
thanx in advance
Nagraj
Hi one_dane,
Thank you very much for your valuable information regarding converting properties file.
Can you please tell which text editor you used to create hindi text file?
I downloaded one hindi font and prepared hindi text in Word Pad. When I converted to properties file, it is showing some garbage text rather than unicode.
Thanks in advance.
Ashok
I usually use SC Unipad, which is an excellent Unicode text editor: http://www.unipad.org/main/
Hi,Can someone please tell me how to actually create a java web application in hindi. Any getting started types link will help.Or please tell me the list of things i need to know before i do this.Thanks in Advance