Oracle xml_dom.writeToClob ignore the character set

I'm trying to generate a xml file using oracle. After generating the xml using dbms_xmldom, it is stored in a CLOB and later written to a table.
The problem is that the character set ('UTF-8') is not included in the header even though it is specified using setCharset() procedure.
Following is the oracle script,
declare
export_file_ CLOB ;
str_export_file_ xmldom.DOMDocument;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
root_elmt xmldom.DOMElement;
begin
str_export_file_ := xmldom.newDOMDocument;
xmldom.setVersion(str_export_file_, '1.0');
xmldom.setCharset(str_export_file_ , 'UTF-8');
main_node := xmldom.makeNode(str_export_file_);
root_elmt := xmldom.createElement(str_export_file_,'TextTranslation');
xmldom.setAttribute( root_elmt, 'version' ,'1.0');
xmldom.setAttribute( root_elmt, 'language' ,'ja');
xmldom.setAttribute( root_elmt, 'module' ,'DEMOAND');
xmldom.setAttribute( root_elmt, 'type' ,'VC');
root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt));
export_file_ :=' ';
xmldom.writeToClob( str_export_file_,export_file_,'UTF-8');
dbms_output.put_line ( export_file_ );
end;
The output is ,
<?xml version="1.0"?>
<TextTranslation version="1.0" language="ja" module="DEMOAND" type="VC"/>
If anybody can suggest me what I have done incorrectly that will be great.
Thanks in advance.

The character set you specify via setCharset() procedure is ignored unless you use writeToFile() later.
http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_xmldom.htm#CHDCGDDB
Usage Notes
This is used for WRITETOFILE Procedures if not explicitly specified at that time.You can also use something like this :
SQL> set serveroutput on
SQL>
SQL> declare
  2 
  3   export_file  clob;
  4   prolog       clob := '<?xml version="1.0" encoding="UTF-8"?>';
  5 
  6  begin
  7 
  8    select prolog || chr(10) ||
  9           xmlserialize(document
10             xmlelement("TextTranslation"
11             , xmlattributes(
12                 '1.0' as "version"
13               , 'ja'  as "language"
14               , 'DEMOAND' as "module"
15               , 'VC' as "type"
16               )
17             )
18             indent
19           )
20    into export_file
21    from dual ;
22 
23    dbms_output.put_line ( export_file );
24 
25  end;
26  /
<?xml version="1.0" encoding="UTF-8"?>
<TextTranslation version="1.0" language="ja" module="DEMOAND" type="VC"/>
PL/SQL procedure successfully completed

Similar Messages

  • Xmldom.writetoclob give wrong character set

    I use xmldom to create a xml clob. I create document for xml as follow:
    doc := xmldom.NewDomDocument;
    xmldom.setVersion(doc, '1.0');
    xmldom.setStandalone(doc, 'no');
    xmldom.setCharSet(doc, 'ISO-8859-1'); -- Should be character set for danish.
    Create xml clob as follow:
    xmldom.writeToClob(root, out_xml);
    Problem: Now is danish 'x, f, e' replace with ??.
    When a use 'xmldom.WriteToFile(root, 'd:\test_document');' I get correctly danish 'x, f, e'!
    I have seen you can use procedure/function 'SetEncoding', but I can not find this function in my Oracle installation (8.1.7.1.1).

    The character set you specify via setCharset() procedure is ignored unless you use writeToFile() later.
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_xmldom.htm#CHDCGDDB
    Usage Notes
    This is used for WRITETOFILE Procedures if not explicitly specified at that time.You can also use something like this :
    SQL> set serveroutput on
    SQL>
    SQL> declare
      2 
      3   export_file  clob;
      4   prolog       clob := '<?xml version="1.0" encoding="UTF-8"?>';
      5 
      6  begin
      7 
      8    select prolog || chr(10) ||
      9           xmlserialize(document
    10             xmlelement("TextTranslation"
    11             , xmlattributes(
    12                 '1.0' as "version"
    13               , 'ja'  as "language"
    14               , 'DEMOAND' as "module"
    15               , 'VC' as "type"
    16               )
    17             )
    18             indent
    19           )
    20    into export_file
    21    from dual ;
    22 
    23    dbms_output.put_line ( export_file );
    24 
    25  end;
    26  /
    <?xml version="1.0" encoding="UTF-8"?>
    <TextTranslation version="1.0" language="ja" module="DEMOAND" type="VC"/>
    PL/SQL procedure successfully completed

  • Precautions i need to take when changing the Character set

    Hi,
    ORACLE VERSION: 10G Release 1 (10.1.0.3.0)
    I am going to change my database's characterset from AL32UTF8 to WE8MSWIN1252 character set and AL16UTF16 NCHAR character set. So i have few questions for you.
    1. What is the difference between Character Set and National Character set? Do i have to set both?
    2. What are precautions that i need to take while changing the characterset?
    3. What are JOB_QUEUE_PROCESSES and AQ_TM_PROCESSES parameters in Plain English? Why do i have to set these parameters to 0 as mentioned in this post below.
    Storing Chinese in Oracle Database

    1) The database character set controls (and specifies) the character set of CHAR & VARCHAR2 columns. The national character set controls the character set of NCHAR & NVARCHAR2 columns.
    2) Please make sure that you read the section of the Globalization manual that discusses character set migration. In particular, going from UTF-8 to Windows-1252 is going to require a bit more work since the latter is a subset (and not a strict binary subset) of the former.
    Justin

  • How to get the character set which i want it to be?

    i confront a problem, when using jdbc to connect to oracle8i database on solaris; because i use getBinaryStream() to read from db in "byte" reading, seemly it would use default character set on OS or database(such as EUC,etc.), not which the client i want it to be. is there anyway to take control of such code writing(i mean to change the character set when i get byte out of database, thus the byte would use NLS_LANG the same as using sqlplus setting in user env)?

    First of all read Note 581312 - Oracle database: licensing restrictions:
    As of point 3, it follows that direct access to the Oracle database is only allowed for tools from the areas of system administration and monitoring. If other software is used, the following actions, among other things, are therefore forbidden at database level:
    Creating database users
    Create database objects
    Querying/changing/creating data in the database
    Using ODBC or other SAP external access methods
    Are you trying this on the database server itself? If yes, then you need to install the hebrew codepages as well as hebrew fonts in order to display the data correctly.
    Markus

  • How to change the character set?

    Platform is win2000 and oracle 8.17. I need to write data in Bulragian. Automatic character converter in oracle didn't work! Database is created already!
    Is there any function in pl/sql or Java that can convert character set in cl8mswin1251? When I read the data from database there are only ?????
    Thank you in advance!

    I'm not sure what you're asking here. "Will it be ok" for what?
    Assuming
    - you read the chapter I linked to,
    - ran the character set scanner,
    - the character set scanner indicated that all your existing data is properly encoded ISO 8859-1
    - the character set scanner indicated that all the ISO 8859-1 data could be converted to Windows-1252
    - all the national character set data was properly encoded in whatever national character set the database had
    - you did the export properly
    - you did the import properly
    - your client NLS_LANG settings are all correct
    then sure, everything should be OK.
    If you skipped one of these steps, I would again strongly encourage you to read the chapter I linked to originally as well as the Metalink article others have pointed you to.
    Justin

  • How to change the Character Set from AL32UTF8 to WE8DEC

    Hello!!
    I want to know how to change the character set in the database from AL32UTF8 to WE8DEC.
    I tried to use the comand ALTER DATABASE CHARACTER SET but I got an error because WE8DEC is not a superset of AL32UTF8.
    I need to import tables from a server that uses WE8DEC. So when I do the import to my server, wich has AL32UTF8 , I can't import the rows that include an Ñ.
    So I want to change the caracter set to WE8DEC. How can I do it?
    Is it needed to change the language configuration? The remote server has AMERICAN_AMERICA, and my server has MEXICAN SPANISH_MEXICO (both uses text in spanish).
    Thanks a lot!!

    When you export from WE8DEC server what did you use
    for NLS_LANG char set? And when importing?
    The export was done in another computer because I can't do the export in the server (I have 10g, and the remote server has 9i and the export is not working). In my server, when I tried to do the import, the NS_LANG value was MEXICAN SPANISH_MEXICO.WE8MSWIN1252.
    When I try to import to my database I got the error:
    import done in WE8DEC character set and AL16UTF16 NCHAR character set
    import server uses AL32UTF8 character set (possible charset conversion)
    export client uses WE8MSWIN1252 character set (possible charset conversion)
    . importing USRMCR06's objects into PRIMARIZACION
    . . importing table "CHG_FONDOS_MARZO_CD_MOR"
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "PRIMARIZACION"."CHG_FONDOS_MARZO_CD_MOR".
    "NOMBRE" (actual: 41, maximum: 40)
    Column 1 16623436
    Column 2
    Column 3 Pymes_1
    Column 4

  • ORACLE invoices with a Japanese character set

    We are having trouble printing ORACLE invoices with a Japanese character set.
    the printer we are using is a Dell W5300,do I need to configure the printer or is it something that needs to be configure in the software?????please help......

    We are having trouble printing ORACLE invoices with a
    Japanese character set.
    the printer we are using is a Dell W5300,do I need to
    configure the printer or is it something that needs
    to be configure in the software?????please help......What is the "trouble"? Are you seeing the wrong output? It may not be the printer, but the software that is sending the output to the printer.
    If you are using an Oracle Client (SQL*Plus, FOrms, Reports etc), ensure you set the NLS_LANG to JAPANESE_JAPAN.WE8MSWIN1252 or JAPANESE_JAPAN.JA16SJIS

  • Find out the character set of a database

    Hi,
    I need to know the character set of a database. I don't know which command or utility can I use.
    Thanks

    This forum is for Oracle Repository.
    However, connect as system and run
    select * from nls_database_parameters
    you should see the nls info.

  • USING THE CHARACTER SET SCANNER

    How can I find and download the Character Set Scanner utility mentioned in MetaLink document # 66320.1.
    Thanks
    Pratap

    I would like to know if there exists a database character set
    scanner for ORACLE816. If not, can I use the ORACLE817 scanner
    to scan my ORACLE816 database?Check out the Globalization Support Home page
    http://technet.oracle.com/tech/globalization/content.html and go
    to the scanner download page for more info.
    Is it important to use a scanner if I am converting my database
    from, say, WE8ISO8859P1 character set to UTF8? Yes definitely. The scanner will identify
    1. If you have any invalid WE8ISO8859P1 data in your database ,
    these will be lost during the character set conversion process.
    2. If there are any data cell expansions, so that column widths
    can be expanded to cater for the new sizing.
    3. Area of possible character set conversion and truncation of
    data.
    Can I assume that a database UTF8 will automatically store all
    my original characters correctly?UTF8 can store all the characters from WE8ISO8859P1 ,and it can
    be stored correctly if your NLS configuration is correct . The
    key is your client NLS_LANG character set setting .
    I have a client with NLS_LANG set to UFT8. When I exported my
    database (in WE8ISO8859P1) from my client, the export was done
    in the client's setting i.e. UTF8. Can I assume that the
    conversion was done at the time of export itself?Yes, your assumption is correct.

  • How can i set the character set ???

    hello
    now i have the following
    Message msg =
    new MimeMessage(Session.getDefaultInstance(props, null));
    how can i set the character set to be 'windows-1256'
    pleaze help if u can
    thanks very much
    Belal

    You have to deal with the NLS_LANG environment variable,it is defined as NLS_LANG=<Language>_<Territory>.<clients characterset> .
    Where is your oracle client installed? On the the server machine, where the database resides , on another Unix system or is it a Windows client? On Windows NLS_LANG is directly related to the OS settings and stored in the registry, on Unix NLS_LANG is not set automatically and defaults (if not set) to AMERICAN_AMERICA.US7ASCII. If you are working on UNIX, this could be the reason for disordering. I'm not familiar with Chinese, so I don't know the correct setting , but a good approach would be same setting as on the server.
    Metalink note 158577.1 describes NLS_LANG very detailed.

  • EAltering the character set

    Hi,
    Can we alter the character set of the Oracle DB, If so please
    give the syntax.
    Regards,
    G. Rajakumar.

    procedure
    1.mount the database
    2.enable restrict session then
    3.change the characterset
    SQL> STARTUP MOUNT;
    SQL> ALTER SYSTEM ENABLE RESTRICED SESSION;
    SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
    SQL> ALTER DATABASE OPEN;
    SQL> ALTER DATABASE CHARACTER SET <new_character_set_name>;
    SQL> SHUTDOWN IMMEDIATE; -- or NORMAL
    SQL> STARTUP;
    there are three types available 1.american,2.western 3.japanese

  • How to define the character set of an outbound EDI batch in BizTalk 2010?

    I have some EDIFACT files with a character set of UNOC though lowercase strings and umlaute should be allowed. These files should be batched in an outbound EDIFACT file. But the batching orchestration of the related send port throws some validation errors.
    If I convert the strings to uppercase characters everything's working fine. So it seems that the outbound batching orchestration uses the UNOA character set internally for the validation of the EDIFACT files...
    How can I change the character set of the outbound batching orchestration in BizTalk 2010? No settings found regarding the character set of outbound batching orchestration in the party and agreement configuration so far. Thank you

    Hi Philipp,
    To define a character set in EDIFACT,
    UNA segment is used. After defining see, How Validation of an EDI Interchange Is Configured and Outbound
    EDI batching in BizTalk Server 
    Maheshkumar S Tiwari|User
    Page | http://tech-findings.blogspot.com/

  • Website not displaying correctly. Firefox is changing the character set to Western (ISO-8859-1) automatically.

    Normally I have set Firefox (or it's set by default) to Character Set Unicode (UTF-8) and everything displays perfectly. I've never had a problem before.
    Now however, whenever I upload my own website, for some bizarre reason on that particular tab (and only that tab) the Character Set is changed over to Western (ISO-8859-1) and then there's a few characters within my site that do not display correctly, namely apostrophes and hypens.
    It definitely isn't my software (Serif WebPlus X4) because the page displays correctly in every other browser. Plus it displays correctly in Firefox if I change the Character set back to Unicode.
    PS The site is a work in progress

    That happens because the server sends a content-type (<b>text/html; charset=ISO-8859-1</b>) via the HTTP response headers and in that case that content type prevails. The page code is saved with an UTF-8 byte order mark () that you see in this case.
    *http://web-sniffer.net/?url=http%3A%2F%2Fwww.valuevisionglasses.co.uk&http=1.1&gzip=yes&type=HEAD&uak=0
    *http://httpd.apache.org/docs/current/mod/mod_mime.html#AddType

  • Changing the character set in RoboHelp 7 file converted from 5

    The character set of the output files for WinHelp defaults to
    utf-8. How can the default be set to windows-1252 per project or
    for all projects in RoboHelp 7?

    This is related to the posting - "RoboHelp 7 (with patch) IE6
    does not display popup field definitions". Somewhere in our
    environment the character set is getting changed to western
    european (ISO) for the pages that do not load initially in IE6/XP
    from the OAS even though the code generated by RoboHelp is utf-8.
    The WebHelp generated in RoboHelp v5 has a characterset of
    windows-1252. None of the pages with the character set of
    windows-1252 have a problem loading (or changing the character
    set). The problem may be on the OAS or the single signon
    layer.

  • How to change the character set of the D/b

    Hello All,
    When i issue the command
    ALTER DATABASE CHARACTER SET UTF8
    It gives me the error that I can only change the character set to a superset of the existing character set.
    Is there any way i can change the character set without recreating the database.
    TIA
    Naveen

    The existing character set is the basis for the new character set. This is fair enough, because the character set determines how the actual data is stored in the database. Allowing new characters is a minor change: completely re-encoding your entire database is not.
    I'm afraid export, recreate and import is your only option.
    Cheers, APC

Maybe you are looking for

  • LPAD in RTF template of BI Publisher help

    I'm trying to use the Lpad feature in hopes when I export to excel I can use calculations based on the numbers. Currently it comes in spaced poorly and will only do counts based off of the values. But I have two columns (BFY and SGL) that have a set

  • Im looking for a phone finder app..like Life360

    I don't think I'm using the app store correctly.  I go to the blue round circle witht the A on it and try the search feature.  I'm looking for a phone or devicing finding app. Ihave one on my Samsung called Life 360 and also put it on an Iphone but d

  • Iconcertcal will not let you open Itunes through Front Row

    Itunes has not been opening through Front Row. I just got off the phone with tech support, and it was because of an Itunes download called iconcertcal. As soon as I removed it, everything worked fine! I don't see it listed on the Apple website anymor

  • Wine-Metastock, dotnet, IE6, and MSJVM

    I need windows for a software called metastock and iE6 with MSJVM. To install that, i got wine. Actualy, metastock depends on dotnet and dotnet depends on IE6. So, i first started with ie6 and tried installing it with "wine ie6setup.exe" and then usi

  • RH8 Hyperlink GUI not working on external links

    Weird one, only on one of our machines! Clicking OK in the Hyperlink window does nothing if an external project file is selected (fine for an internal file). Entering the link manually is fine (works in Preview and output). However, the problem remai