Il giorno mer, 25-05-2005 alle 14:59 -0500, Kris Jurka ha scritto:
[...]
> You are assuming that each character is only one byte. The backend lexing
> rules are a byte by byte operation, but the JDBC side is returning a
> String of characters. Consider the character "Latin Small Letter s with
> Acute" (\u015B) gets encoded in UTF-8 as C5 9B or \305\233 in octal. This
> is one character in the result of getExtraNameCharacters.
Thank you very much for your reply.
Yes, I assumed that this was a one-byte character encoding and I didn't
know that \200 < \305\233 < \377.
I was also assuming (maybe wrongly) that JDBC driver convert java utf-8
characters to ASCII when connecting to postgresql backend. This is why I
counted 191 characters.
I also made a test: "CREATE TABLE A\u015B ( A VARCHAR(30) )"
fails when calling java.sql.Statement.execute(). The error is:
ERROR: syntax error at or near "["
Looking at the postgresql log, I found the statement was translated in
"CREATE TABLE A[ ( A VARCHAR(30))"
Similarly, "CREATE TABLE A\u00C0 ( A VARCHAR(30) )" succeeds.
so maybe postgresql doesn't accept a broad range of utf-8 characters,
while it might accept the ASCII characters from \200 to \377 when it is
a Character.isLetterOrDigit().
May it be something dependant on the database encoding?
Thanks again,
Giuseppe