Re: [JDBC] RE : ? (question mark) characters
Barry Lind a écrit : Kovács Péter wrote: the driver what character set the backend is sending us? Can't it ask the backend dynamically? This is what it actually does, isn't it? (Based on what I usually see in the trace output on the backend.) I tested a unicode database with varchar(255) fields and hungarian accented characters and it worked just fine. (With PostgreSQL 7.2.1 I think.) Yes this is exactly what the driver does. It asks the server what character set is being used for the database. Unfortunatly the server only knows about character sets if multibyte support is compiled in. If the server is compiled without multibyte, then it always reports to the client that the character set is SQL_ASCII (where SQL_ASCII is 7bit ascii). Thus if you don't have multibyte enabled on the server you can't support 8bit characters through the jdbc driver, unless you specifically tell the connection what character set to use (i.e. override the default obtained from the server). thanks, --Barry Thanks for the answer. I am using a postgresql server rebuilt from a rawhide SRPM and I guess it is not enabled by default (I can't check cause I don't have the SRPM anymore on my hd...). It is a lot better to turn this option on by default though the current solution (setting the charset properties manually fit me very well for my own development). Quentin -- Quentin DELANCE e-mail : [EMAIL PROTECTED] ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [JDBC] RE : ? (question mark) characters
the driver what character set the backend is sending us? Can't it ask the backend dynamically? This is what it actually does, isn't it? (Based on what I usually see in the trace output on the backend.) I tested a unicode database with varchar(255) fields and hungarian accented characters and it worked just fine. (With PostgreSQL 7.2.1 I think.) Peter ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [JDBC] RE : ? (question mark) characters
On Mon, 03 Sep 2001 09:49:27 -0700, you wrote: Yes this is exactly what the driver does. It asks the server what character set is being used for the database. Unfortunatly the server only knows about character sets if multibyte support is compiled in. If the server is compiled without multibyte, then it always reports to the client that the character set is SQL_ASCII (where SQL_ASCII is 7bit ascii). Thus if you don't have multibyte enabled on the server you can't support 8bit characters through the jdbc driver, unless you specifically tell the connection what character set to use (i.e. override the default obtained from the server). Excellent explanation, thanks. This would be great info for the FAQ. I've seen this issue appear three times or so in the relatively short time I'm on this list. Regards, René Pijlman [EMAIL PROTECTED] ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [JDBC] RE : ? (question mark) characters
Kovács Péter wrote: the driver what character set the backend is sending us? Can't it ask the backend dynamically? This is what it actually does, isn't it? (Based on what I usually see in the trace output on the backend.) I tested a unicode database with varchar(255) fields and hungarian accented characters and it worked just fine. (With PostgreSQL 7.2.1 I think.) Yes this is exactly what the driver does. It asks the server what character set is being used for the database. Unfortunatly the server only knows about character sets if multibyte support is compiled in. If the server is compiled without multibyte, then it always reports to the client that the character set is SQL_ASCII (where SQL_ASCII is 7bit ascii). Thus if you don't have multibyte enabled on the server you can't support 8bit characters through the jdbc driver, unless you specifically tell the connection what character set to use (i.e. override the default obtained from the server). thanks, --Barry ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [JDBC] RE : ? (question mark) characters
I'm forwarding this workaround to the list. Can someone shed some light on this? Java uses Unicode and should be able to represent all ISO Latin-1 (8859-1) encoded characters. Why would we need to tell the driver what character set the backend is sending us? Can't it ask the backend dynamically? On Sat, 01 Sep 2001 22:34:49 +0200, Quentin Delance wrote: I ve just read that you were having questions about non ascii characters support when accessing a posgresql DB through JDBC. As I am french (éèà...), I got the same problem but here is the solution (found on an old mailling list). While connecting to the db, don't use the DriverManager.getConnection(url,login,passwd) API but instead DriverManager.getConnection(url,properties) and set your charSet in these properties. Example : Properties info = new Properties(); info.put(user,login); info.put(password,passwd); info.put(charSet,ISO8859_1); dbCon = DriverManager.getConnection(dbURL,info); While calling getString on a ResultSet, you should not get '?' chars any more. Hope this helps, Quentin Regards, René Pijlman [EMAIL PROTECTED] ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [JDBC] Re: ? (question mark) characters
On Thu, 2001-08-30 at 18:41, Barry Lind wrote: Ricardo, Is your database compiled for multibyte support? And what character set is the database you are connecting to created with? (to get the database character set do a 'psql -l'). If the answer to the first question is no or the answer to the second question is 'SQL_ASCII', then only 7bit characters are supported. : Ok, I tried all the drivers currently available at http://jdbc.fastcrypt.com. They all seem to correct the problem with long (8k) SQL statements, but they're all broken considering Portuguese characters like áéíóú (aeiou with accent)... they are replaced by question marks (?)... any ideas? Should I try to compile my own drivers? How? BTW I am using JDK 1.3 from Sun (Solaris and Linux)... For portugese you should be using -E LATIN1 Cheers Tony Grant -- RedHat Linux on Sony Vaio C1XD/S http://www.animaproductions.com/linux2.html Macromedia UltraDev with PostgreSQL http://www.animaproductions.com/ultra.html ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[JDBC] Re: ? (question mark) characters
Ok, I tried all the drivers currently available at http://jdbc.fastcrypt.com. They all seem to correct the problem with long (8k) SQL statements, but they're all broken considering Portuguese characters like áéíóú (aeiou with accent)... they are replaced by question marks (?)... any ideas? Should I try to compile my own drivers? How? BTW I am using JDK 1.3 from Sun (Solaris and Linux)... I suspect the problem is not with the jdbc driver but with the way you have configured postgres, try building postgres with: ./configure --with-java --enable-multibyte=UNICODE --enable-unicode-conversion And use initdb with the -E UNICODE option: initdb -E UNICODE -D [path to data directory] And see if that works, good luck! Michael ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[JDBC] Re: ? (question mark) characters
Ricardo, Is your database compiled for multibyte support? And what character set is the database you are connecting to created with? (to get the database character set do a 'psql -l'). If the answer to the first question is no or the answer to the second question is 'SQL_ASCII', then only 7bit characters are supported. thanks, --Barry Ricardo Pardini wrote: Ok, I tried all the drivers currently available at http://jdbc.fastcrypt.com. They all seem to correct the problem with long (8k) SQL statements, but they're all broken considering Portuguese characters like áéíóú (aeiou with accent)... they are replaced by question marks (?)... any ideas? Should I try to compile my own drivers? How? BTW I am using JDK 1.3 from Sun (Solaris and Linux)... ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly