This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Reading hindi text from excel file and getting its corresponding unicode

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ,

I have a requirement where i have to read hindi text from an excel sheet and write it onto a app_hi.properties file. The problem is in the hindi propeties file we need to have the unicode of the hindi word for it to get reflected on the screen and i am not able to do this. I am able to read the hindi text from excel but i dont know how to convert it to unicode. When i run mhy code in debug mode or try to print the hindi string , only a set of ??? are displayed.

Can anyone please help me with this.

I am not sure if this is the right forum for this question. Please let me know if i have posted it in the wrong place.

thanks
 
Sheriff
Posts: 21817
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The console can't handle anything that's not ASCII most of the time. Does it work if you write to a text file instead, then open that text file in a unicode-able text editor?
 
varsha rao
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am able to read the hindi code from the excel sheet , but i need to convert the hindi characters to the corresponding unicode.

My prog should read hindi code from excel and write the corresponding unicode to a properties file.


Excel sheet data Properties file data

पुन:आरंभ करें read this and write --> \u0905\u0928\u0941\u0930\u094b\u0927\u002


There is a tool called unipad which provides the unicode for hindi words but do we have any api's in java to use any such tool?

Is there any way for achieving this ?
 
varsha rao
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I found a solution for this. In Java5.0 the Character class provides methods which will return the code point for a given char[] array

codePointAt(char[] a, int index) ;

Using this method we can get the Unicode for a String in any Language which can be displayed on the browser

// here is the method for the same "value" is the String in hindi (or any other) Language

public static String getUnicode(String value)
{

StringBuffer testBuffer = new StringBuffer();
char[] test = value.toCharArray();

if(test != null)
{
int size1 = test.length;


for(int j = 0 ; j < size1;j++)
{
testBuffer.append("&#");
testBuffer.append(Character.codePointAt(test, j));
testBuffer.append(";");
}


}

return testBuffer.toString();
}

This method will return you the correspoding unicode in dec which you can write to a properties file and use the samefor display

Reference : http://en.wikipedia.org/wiki/Unicode_and_HTML


Thanks
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!