File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UTF-8

 
Lily Boland
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Does any one know a good way to parse in a UTF-8 xml file, store it in ASCII in DB, and export it back to UTF-8 format?

Thanks,
Lily
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to ask the obvious, is there no way to run the DB in Unicode mode, instead of ASCII?

One possibility would be to base-64 encode the string with a library like Jakarta Commons Codec.
[ August 30, 2006: Message edited by: Ulf Dittmer ]
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am not clear but just thinking about following ...

The Reader and writer streams will convert back and forth of UTF format. First write your file into a ByteArrayOutputStream then store it in DB and after reading the data from DB again construct it with Reader.

UTF -----> Writer(Stream); -----> DB

DB ---> Reader(Stream) ---> UTF format

Please correct me If anything wrong.

Thank you.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use a standard XML parser and JDBC, isn't encoding taken care of automatically?
 
Manuel Palacio
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually base-64 encode it, store in the DB and then decode with:

 
Lily Boland
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for the helpful info!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic