2 Replies Latest reply: Mar 30, 2006 8:15 AM by mdrake RSS

    Conversion UTF-8 -> WINDOWS-1250

    276321
      In a table I have clob column. Content is XML starting with
      <?xml version="1.0" encoding="UTF-8"?>.
      I transfer this content (with insert) into another table with column of type XMLType.

      But the side effect of this is unwanted conversion
      <?xml version="1.0" encoding="UTF-8"?> to <?xml version="1.0" encoding="WINDOWS-1250"?>.
      This makes troubles in my application.

      What is the reason of conversion an how can I avoid it. Everything is inside the same DB schema.

      Regards, Saso
        • 1. Re: Conversion UTF-8 -> WINDOWS-1250
          mdrake
          Which database version are you working with. What is the database charactere set ?. The conversion is probably not happening when you do the insert it is probably happening when you fetch the document. Are you fetching the data via SQL*PLUS. XML DB automatically converts to the client characater set when the docuemnt is retreieved.
          • 2. Re: Conversion UTF-8 -> WINDOWS-1250
            mdrake
            For Example

            Database character set is AL32UTF, Client character set is WIN1252.
            SQL> drop table test
              2  /
            
            Table dropped.
            
            SQL> create table test of xmltype;
            
            Table created.
            
            SQL> insert into test values (xmltype('<?xml version="1.0" encoding="UTF-8"?><FOO/>'));
            
            1 row created.
            
            SQL> commit;
            
            Commit complete.
            
            SQL> select object_value from test;
            
            OBJECT_VALUE
            --------------------------------------------------------------------------------
            <?xml version="1.0" encoding="WINDOWS-1252"?>
            <FOO/>
            
            
            SQL> select x.object_value.getClobVal() from test x;
            
            X.OBJECT_VALUE.GETCLOBVAL()
            --------------------------------------------------------------------------------
            <?xml version="1.0" encoding="UTF-8"?><FOO/>
            
            SQL> exit
            Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
            With the Partitioning, OLAP and Data Mining options
            
            C:\TEMP>set NLS_LANG=AMERICAN_AMERICA.AL32UTF8
            
            C:\TEMP>sqlplus scott/tiger
            
            SQL*Plus: Release 10.2.0.2.0 - Production on Thu Mar 30 06:12:24 2006
            
            Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
            
            
            Connected to:
            Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
            With the Partitioning, OLAP and Data Mining options
            
            SQL> select *  from test;
            
            SYS_NC_ROWINFO$
            --------------------------------------------------------------------------------
            <?xml version="1.0" encoding="UTF-8"?><FOO/>
            
            SQL>