• Post Reply Bookmark Topic Watch Topic
  • New Topic

ASCII to UNICODE  RSS feed

 
Anish Raj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I need to conver a string in ASCII to UNICODE using java. Please let me know if there is an easy way.
Thanks in advance.
Anish
 
Angel Dobbs-Sciortino
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The values for ASCII characters are the same values in Unicode. Java uses Unicode by default.
Angel
 
Anish Raj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.. it works in HTML ( HTML displays the same way for both ASCII and UNICODE) , But I am trying to create a PDF where it needs unicode. My ASCII characters are for a japanese lable and I am getting the ASCII as it is in the PDF where are if I put the UNICODE characters I am getting the correct japanese characters in my PDF.
Please let me know what you think.
Thanks a lot for your reply!
 
steve anson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had problem when I needed to save text out to a file in UTF-8,
Internally all character data is represented as unicode but I had much problem saving to file as unicode. Got round it like this:
File f= new File(folder, fName);
InputStream in = new FileInputStream(f);
System.setProperty("file.encoding", "UTF-8");
String encoding = System.getProperty("file.encoding"); Reader r= new BufferedReader(new InputStreamReader(in, encoding));
Does that help?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!