Thread: XML encoding


Permlink Replies: 3 - Pages: 1 - Last Post: Jul 12, 2006 7:20 AM Last Post By: mdrake
harryb

Posts: 104
Registered: 03/04/99
XML encoding
Posted: Jul 11, 2006 3:38 PM
Click to report abuse...   Click to reply to this thread Reply
My SQL/XML procedure produces an instance document with "encoding=US-ASCII". I need this to be UTF-8. The database character set is US8PC437. Is there somewhere I can specify UTF-8?

Thanks,
Harry
mdrake

Posts: 5,305
Registered: 01/10/01
Re: XML encoding
Posted: Jul 11, 2006 3:49 PM   in response to: harryb in response to: harryb
Click to report abuse...   Click to reply to this thread Reply
Which release of the database are you using..

How are you access the result of your procedure, (SQL*PLUS, Java).. Basically if you get the XMLType, as distinct from a CLOB the XML should be presented in the character set requested by the client. In SQL*PLUS this will be determined by the NLS_LANG environment setting. From Java you will always get UTF8. If you fetch the XML as a CLOB you should see it in the database character set.
harryb

Posts: 104
Registered: 03/04/99
Re: XML encoding
Posted: Jul 12, 2006 7:14 AM   in response to: mdrake in response to: mdrake
Click to report abuse...   Click to reply to this thread Reply
Which release of the database are you using..

How are you access the result of your procedure,
(SQL*PLUS, Java).. Basically if you get the XMLType,
as distinct from a CLOB the XML should be presented
in the character set requested by the client. In
SQL*PLUS this will be determined by the NLS_LANG
environment setting. From Java you will always get
UTF8. If you fetch the XML as a CLOB you should see
it in the database character set.


Sorry - this is Oracle 10.2.0.1.0. The calling program is C#, here's a snippet:

Select SYS.XMLTYPE.GETCLOBVAL(CAFO_DATA) from CAFO_XML

Thanks,
Harry
mdrake

Posts: 5,305
Registered: 01/10/01
Re: XML encoding
Posted: Jul 12, 2006 7:20 AM   in response to: harryb in response to: harryb
Click to report abuse...   Click to reply to this thread Reply
XML DB (and the database in general) will convert to the character set requested by the client..

See

http://forums.oracle.com/forums/thread.jspa?messageID=1255505&#1255505

How are you accessing the database. ODP.NET ? I think that's OCI based so it should honor the NLS_LANG setting.

However you are invoking .getClobVal() and getting a CLOB which means you get it in the database character set...

You can also try something like

select value(x).getBlobVal(nls_charset_id('AL32UTF8')) from foo x
/

Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums