Link to home
Start Free TrialLog in
Avatar of Manish
ManishFlag for India

asked on

XML data into database problem


Hi experts,
  I am getting value from xml which has encoding UTF-8, ex.
  Take Advantage of abc’s NYC ‘Bike Room’   .
After inserting it into oracle db, I am getting value
  Take Advantage of abc.s NYC .Bike Room   .
While displaying on JSP page
Take Advantage of abc HSBCs HSBCs sBike Rooms

How to solve this?
karan
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You need to have a font installed capable of reproducing those characters and you need to set your JSP to the correct character encoding
Avatar of Manish

ASKER

I am storing xml value in java class.
Avatar of Manish

ASKER

IN JSP, I have this...
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
Is your JSP publicly accessible?
Avatar of Manish

ASKER

>> Is your JSP publicly accessible?
   Didnt get u?
 
I am showing on JSP above String from database, its look like above ..



Can we connect to it?
Avatar of Manish

ASKER

No, its not accessible to outside.

Hard code some html with the same encoding setting and characters and see if they appear correctly
Avatar of Manish

ASKER

Why it oracle db has above value after inserting..
Take Advantage of abc.s NYC .Bike Room  instead of
Take Advantage of abc’s NYC ‘Bike Room’
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Manish

ASKER

I directly hardcoded above value in HTML , it is showing correctly,
Problem I think storing in db and getting it..
karan
Avatar of Manish

ASKER

>> You need to set the oracle encoding to UTF8
How?
Make sure db encoding set to utf8
Run the following query and post the result:

select parameter, value from nls_database_parameters where parameter=NLS_CHARACTERSET';
Missing quote sorry

select parameter, value from nls_database_parameters where parameter='NLS_CHARACTERSET';
Avatar of Manish

ASKER

NLS_CHARACTERSET               US7ASCII
There you are - it's wrong. It should be UTF8
Avatar of Manish

ASKER

how to make it UTF-8?
Check your Oracle docs for your particular version
Avatar of Manish

ASKER

This we have database side option.
Is there any way we can do in java , if above charset is not going to change in db.?
karan
You can't save those right and left quotes in ASCII - they don't exist
Avatar of Manish

ASKER

can we change it and store it in db? so that output would be same.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Manish

ASKER

This may be only for one character,
   Can I make it general code so that any other such special character can be inserted in db
properly.
karan
Not easily - UTF-8 supports thousands of characters, ASCII only a maximum of a couple of hundred. You need to set up the db encoding to receive the input it's getting
Avatar of Manish

ASKER

I am using
string.getBytes("ISO-8859-1"),"UTF-8" to change ISO-8859-1 to UTF-8.
It is working fine , but on some machine , jsp showing french character corrupted.
ex. "'édition bannière étiolée sûrement déjà  celui là "

Just for info.
I am using JSTL in jsp.
charset is UTF-8
Also I m using fmt for setLocale etc.
 
Avatar of Manish

ASKER

all,
    I increased the points of question, so anybody try to give answer.
karan