Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2017-09

Oracle CLOB and UTF8

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dave Connolly

Hi all,

I've got a database with a CLOB column containing "abcdefgáéíóúøå"

I'm using the TOracleConnection to select this data and it comes back corrupted "abcdefgáéí�"

This only happens when using a CLOB. If I put the same data in a VARCHAR2 or NVARCHAR2 the results are correct.

The OCILobGetLength in the procedure TOracleConnection.LoadBlobIntoBuffer returns 14. This is the number of characters in the string, but it is not taking the double-byte characters into account. The length in the case should be 21.

Is this a known issue?

Many thanks,
Dave

Reply by email

Michael Van Canneyt
to Dave Connolly
Dave Connolly wrote 16 lines
Hi all, I've got a database with a CLOB column containing "abcdefgáéíóúøå" I'm using the TOracleConnection to select this data and it comes back corrupted "abcdefgáéí???" This only happens when using a CLOB. If I put the same data in a VARCHAR2 or NVARCHAR2 the results are correct. The OCILobGetLength in the procedure TOracleConnection.LoadBlobIntoBuffer returns 14. This is the number of characters in the string, but it is not taking the double-byte characters into account. The length in the case should be 21. Is this a known issue?

No, it is not. Please report it in the bugtracker.

Michael.

Reply by email

LacaK
to Dave Connolly: I've got a database with a CLOB column containing "abcdefgáéíóúøå" I'm using the…

Hi,

as far as I remember I have problems (when I have implemented support for CLOBs) you describe as well.

I do not have access to Oracle DB anymore so I can not fix it, worse I am not aware of easy way how to get from OCI API information about byte length (and connection character set) ... I have never used Oracle DB except for one period when I have fixed some errors found in our db test suite.

There are some API functions like OCILobCharSetId(), which probably can be used to guess "character length" based on known character set ids.

If you are aware of working solution, please submit bug report and attach patch ...
Thanks
-Laco.

Show quoted text 25 lines
Hi all, I've got a database with a CLOB column containing "abcdefgáéíóúøå" I'm using the TOracleConnection to select this data and it comes back corrupted "abcdefgáéí�" This only happens when using a CLOB. If I put the same data in a VARCHAR2 or NVARCHAR2 the results are correct. The OCILobGetLength in the procedure TOracleConnection.LoadBlobIntoBuffer returns 14. This is the number of characters in the string, but it is not taking the double-byte characters into account. The length in the case should be 21. Is this a known issue? Many thanks, Dave _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Dave Connolly
to LacaK

Raised as bug 0032377 <https://bugs.freepascal.org/view.php?id=32377>

LacaK wrote 50 lines
Hi, as far as I remember I have problems (when I have implemented support for CLOBs) you describe as well. I do not have access to Oracle DB anymore so I can not fix it, worse I am not aware of easy way how to get from OCI API information about byte length (and connection character set) ... I have never used Oracle DB except for one period when I have fixed some errors found in our db test suite. There are some API functions like OCILobCharSetId(), which probably can be used to guess "character length" based on known character set ids. If you are aware of working solution, please submit bug report and attach patch ... Thanks -Laco. Hi all, I've got a database with a CLOB column containing "abcdefgáéíóúøå" I'm using the TOracleConnection to select this data and it comes back corrupted "abcdefgáéí�" This only happens when using a CLOB. If I put the same data in a VARCHAR2 or NVARCHAR2 the results are correct. The OCILobGetLength in the procedure TOracleConnection.LoadBlobIntoBuffer returns 14. This is the number of characters in the string, but it is not taking the double-byte characters into account. The length in the case should be 21. Is this a known issue? Many thanks, Dave _______________________________________________ fpc-devel maillist - _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email