This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

UTF-8  RSS feed

 
Greenhorn
Posts: 11
  • 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
 
Rancher
Posts: 42975
76
  • 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 ]
 
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • 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.
 
author
Sheriff
Posts: 14112
  • 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?
 
Ranch Hand
Posts: 45
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for the helpful info!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!