Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> CONVERT(desc, 'AL16UTF16', 'AL32UTF8') seems to return invalid Unicode chars

CONVERT(desc, 'AL16UTF16', 'AL32UTF8') seems to return invalid Unicode chars

From: <sandeepkhare_at_yahoo.com>
Date: 16 Feb 2006 19:55:54 -0800
Message-ID: <1140148554.668429.19050@z14g2000cwz.googlegroups.com>


I am trying to extract data from Oracle 10G DB (on Windows XP) which has AL32UTF8 encoding. I want to extract the data in UTF16 format. I use the following SQL statements to retrieve the data

set termout off
set newpage 0
set space 0
set pagesize 0
set echo off
set feedback off
set heading off
set verify off
set SERVEROUT off
set linesize 100
spool c:\temp\tt.txt
SELECT CONVERT(name, 'AL16UTF16', 'AL32UTF8') FROM MY_TABLE ; spool off;

When I look at the file (open in Textpad in Binary mode) I see two bytes for each of the character as expected. But the bytes do not seem to have correct Unicode encoding

For example the Letter 'T' shows as Hex '20','54' instead of Hex '00', '54' (The Unicode representation of 'T' is hex 0054 not hex 2054 as per unicode.org).

Why does SQL*Plus outputs '20' instead of '00' as leading byte for ASCII chars in UTF-16 encoding? The Convert function works fine with PL SQL procedure.

Any help will be greatly appreciated. Received on Thu Feb 16 2006 - 21:55:54 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US