Read/write incorrect in DB oracle with Chinese characters

General discussion forum about all databases other than SqlBase.
RicoT

Read/write incorrect in DB oracle with Chinese characters

Post by RicoT » 02 Jul 2012, 15:25

Dear all,

I just pass on version 6.1 SP1 of TD with Oracle 10G database.(I was using version 4.2.)
The data are in Chinese (16bits encoding for these characters).
With TD 4.2, I had no problems, but TD 6.1 can neither read nor write correctly the information ... It seems the problem come from the oracle dll drivers.

Enclosed this post, the setting of my database and an example of the data reported by TD and what should be reported.
BUG_Oracle_Chinois.JPG
2012-07-02_164131.jpg
best regards
You do not have the required permissions to view the files attached to this post.
Last edited by RicoT on 04 Jul 2012, 15:31, edited 1 time in total.

Jeff Luther

Re: Read/write incorrect in DB oracle with Chinese characters

Post by Jeff Luther » 04 Jul 2012, 00:34

My guess is that because of v4.2 you have some ANSI data in your Oracle DB and now with TD v6.x and Unicode, your app is fetching and displaying that ANSI data 'as is,' and TD cannot display ANSI data -- in a msg. box, field, table window column, etc.

Write yourself a small test case to fetch this CLT data and test by calling TD functionSalStrToWideChar(), which converts an ANSI string to Unicode. See TD help for details, but something like:
! assume sINPUT_ANSIString is an INTO var. in your SELECT query...

Call SalStrToWideChar( sINPUT_ANSIString, sOUTPUT_UnicodeString, ENC_UTF8 )

! now sOUTPUT_UnicodeString should be Unicode, so you could put that in a msg. box, assign to your "NOM" TW column for that row, etc.

I'D RECOMMEND you keep it very simple at first:
* fetch CLT into sINPUT_ANSIString
* call the WideChar function
* display sOUTPUT_UnicodeString in a SalMessageBox

RicoT

Re: Read/write incorrect in DB oracle with Chinese characters

Post by RicoT » 04 Jul 2012, 15:42

Thank you for your prompt answer.

We have already tried to convert the received characters, without success ...

Here after is our code, for each message called in TD I join the result:

Set sMSG = "no connexion"
If NOT SqlConnect ( hSql )
Return FALSE
Call SqlPrepareAndExecute( hSql, " SELECT NOM FROM CLT
WHERE IDTCLT = '1289'
INTO :sNOM ")
Call SqlFetchNext( hSql, nInd )
Set sMSG = sNOM
Call SalMessageBox ( sMSG , "Fetch" , 16 )


Without conversion:
1.jpg
Call SalStrToMultiByte( sNOM, sMSG, ENC_UTF8 )
Call SalMessageBox ( sMSG , "SalStrToMultiByte" , 16 )


a result, but not the good one...
2.jpg
Call SalStrToWideChar( sNOM, sMSG, ENC_UTF8)
Call SalMessageBox ( sMSG , "SalStrToWideChar " , 16 )


no data after conversion:
3.jpg
Best regards
You do not have the required permissions to view the files attached to this post.

RicoT

Re: Read/write incorrect in DB oracle with Chinese characters

Post by RicoT » 01 Oct 2012, 15:12

TD in older versions was less accurate about the type of string and we take advantage (without knowing) of a mistake we made in the Oracle database.
Indeed, for Chinese characters, WE8ISO8851P1 character set is incorrect! We therefore migrate WE8ISO8859P1 character set to ZHS16GBK.

The probleme is solve.

Best regards.

RicoT

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests