The Oracle Unicode problem when using NLS_CHARACTERSET is WE8ISO8859P1, and NLS_NCHAR_CHARACTERSET is AL16UTF16, and ColdFusion as a programming language

I have 2 Oracle 10g, XE and Enterprise databases

X

enter image description here

enter image description here

Company

enter image description here

enter image description here

and this is the type of data that I use in the test pattern

enter image description here

enter image description here

and then I tried to test to insert some Unicode char from http://www.sustainablegis.com/unicode/

and results

X

enter image description here

Company

enter image description here

for this test I am using ColdFusion 9 developer version

<cfprocessingDirective pageencoding="utf-8"> 
<cfset setEncoding("form","utf-8")>

<form action="" method="post">
Unicode : <br>
<textarea name="txaUnicode" id="txaUnicode" cols="50" rows="10"></textarea>
<br><br>
Language : <br>
<input type="Text" name="txtLanguage" id="txtLanguage">
<br><br>
<input type="Submit">
</form>

<cfset dsn = "theDSN">

<cfif StructKeyExists(FORM, "FIELDNAMES")>
    <cfquery name="qryInsert" datasource="#dsn#">
        INSERT INTO UNICODE
        (
            C_VARCHAR2,
            C_CHAR,
            C_CLOB,
            C_NVARCHAR2,
            LANGUAGE
        )
        VALUES
        (
            <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#FORM.TXAUNICODE#">,
            <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#FORM.TXAUNICODE#">,
            <cfqueryparam cfsqltype="CF_SQL_LONGVARCHAR" value="#FORM.TXAUNICODE#">,
            <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#FORM.TXAUNICODE#">,
            <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#FORM.TXTLANGUAGE#">
        )
    </cfquery>
</cfif>

<cfquery name="qryUnicode" datasource="#dsn#">
    SELECT  *
    FROM    UNICODE
    ORDER BY    LANGUAGE
</cfquery>

<table border="1">
    <thead>
        <tr>
            <th>LANGUAGE</th>
            <th>C_VARCHAR2</th>
            <th>C_CHAR</th>
            <th>C_CLOB</th>
            <th>C_NVARCHAR2</th>
        </tr>
     </thead>
     <tbody>
        <cfoutput query="qryUnicode">
            <tr>
                <td>#qryUnicode.LANGUAGE#</td>
                <td>#qryUnicode.C_VARCHAR2#</td>
                <td>#qryUnicode.C_CHAR#</td>
                <td>#qryUnicode.C_CLOB#</td>
                <td>#qryUnicode.C_NVARCHAR2#</td>
            </tr>
        </cfoutput>
    </tbody>
</table>

http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10749/ch6unicode.htm#i1007297 , Enterprise , XE ( , NVARCHAR2), :

  • NCHAR NVARCHAR2 Unicode.
  • WE8ISO8859P1
  • AL16UTF16

, Enterprise?

. :)

+5
4

utf-8, iso-8859-1 ( N-datatypes), utf-8, , .

+1
0

NVARCHAR2 combined with WE8ISO88591 has an unpleasant side effect if you use literals in queries. The entire request is converted through the NLS_CHARSET encoding, so if it cannot encode your characters, you may have problems. But this should not happen with related parameters.

0
source

All Articles