[cl-rdbms-devel] hu.dwim.rdbms.oracle-utf-problems-6 - trailing zero byte problem for ascii characters using utf-8?

Marshall McLuhan marshall.mcluhan at gmx.net
Wed Nov 3 13:15:41 UTC 2010


The converter doesn't seem to remove the second byte which is zero. ( 66 00 6F 00 6F 00 equals "foo" )
As far as I know UTF-8 uses only one byte per ascii character. How do I get this thing to remove the zero byte?



12:20 0           RDBMS DRIBBLE Convert from 5, size is 90, content:
66 00 6F 00 6F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 


hex    binary    dec
0    0000    0
1    0001     1
2    0010     2
3    0011     3
4    0100     4
5    0101     5
6    0110     6
7    0111     7
8    1000     8

9    1001     9
A    1010     10
B    1011     11
C    1100     12
D    1101     13
E    1110     14
F    1111     15



*** How it should be:

ORACLE> #B01100110  ;  HEX: 66
102
ORACLE> (char-code #\f)
           
102



*** How it is

* (select-symtag2)
13:34 0           RDBMS DEBUG   About to BEGIN transaction in database #<ORACLE {1002AB8041}>
13:34 0             SQL DRIBBLE SELECT SYMTAG_KEY FROM symtag
13:34 0           RDBMS DEBUG   Executing "SELECT SYMTAG_KEY FROM symtag"
STYLE-WARNING: Undefined alien: "OCIGetInstantClientPackageName"
STYLE-WARNING: Undefined alien: "OCIGetInstantClientPackageName"
13:34 0           RDBMS DEBUG   Connecting in transaction #<#<STANDARD-CLASS NIL {10030AFD91}> :begin-executed-p #t {1003E4FDA1}>
13:34 0           RDBMS DEBUG   Logging on in transaction #<#<STANDARD-CLASS NIL {10030AFD91}> :begin-executed-p #t {1003E4FDA1}>
13:34 0           RDBMS DEBUG   Preparing command: "SELECT SYMTAG_KEY FROM symtag"
13:34 0           RDBMS DRIBBLE Statement is allocated
13:34 0           RDBMS DRIBBLE Retrieving column: name="??????????", type=1, size=44
13:34 0           RDBMS DEBUG   Fetching "??????????" from buffer at index 0
13:34 0           RDBMS DRIBBLE Convert from 5, size is 90, content:
66 00 6F 00 6F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
..

#<(AND (VECTOR T 8) (NOT SIMPLE-ARRAY)) {1003F01CBF}>
* (setq x *)

#<(AND (VECTOR T 8) (NOT SIMPLE-ARRAY)) {1003F01CBF}>
* (elt (elt x 0) 0)

"???"
* (elt * 0)

#\U6600   ; this should be the character #\f
* (setq y *)

#\U6600
* (char-code y)

26112 ; this should be the char-code 102
* 


!DSPAM:4cd1607e48581541520698!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-rdbms-devel/attachments/20101103/92bce6de/attachment.html>


More information about the cl-rdbms-devel mailing list