Manish
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
You need to have a font installed capable of reproducing those characters and you need to set your JSP to the correct character encoding
ASKER
I am storing xml value in java class.
ASKER
IN JSP, I have this...
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
Is your JSP publicly accessible?
ASKER
>> Is your JSP publicly accessible?
Didnt get u?
I am showing on JSP above String from database, its look like above ..
Didnt get u?
I am showing on JSP above String from database, its look like above ..
Can we connect to it?
ASKER
No, its not accessible to outside.
Hard code some html with the same encoding setting and characters and see if they appear correctly
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’
Take Advantage of abc.s NYC .Bike Room instead of
Take Advantage of abc’s NYC ‘Bike Room’
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I directly hardcoded above value in HTML , it is showing correctly,
Problem I think storing in db and getting it..
karan
Problem I think storing in db and getting it..
karan
ASKER
>> You need to set the oracle encoding to UTF8
How?
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 ';
select parameter, value from nls_database_parameters where parameter=NLS_CHARACTERSET
Missing quote sorry
select parameter, value from nls_database_parameters where parameter='NLS_CHARACTERSE T';
select parameter, value from nls_database_parameters where parameter='NLS_CHARACTERSE
ASKER
NLS_CHARACTERSET US7ASCII
There you are - it's wrong. It should be UTF8
ASKER
how to make it UTF-8?
Check your Oracle docs for your particular version
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
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
ASKER
can we change it and store it in db? so that output would be same.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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.
string.getBytes("ISO-8859-
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.
ASKER
all,
I increased the points of question, so anybody try to give answer.
karan
I increased the points of question, so anybody try to give answer.
karan