Subject | Automatic encoding value (jdbc:xxxx?encoding=auto)? |
---|---|
Author | mailmur |
Post date | 2006-10-07T17:24:42Z |
I have a Firebird2 database with default UTF8 encoding for all string
columns. All is fine if clients know adding "encoding=UTF8" url
parameter before creating a connection.
But if some of the clients don't use it then application cannot
display values properly.
I have created a (very) simple query tool to test it:
http://koti.mbnet.fi/akini/fb/
url with encoding:
jdbc:firebirdsql:localhost:c:/fb2/db/TESTUTF8.fdb?encoding=UTF8&user=sysdba&password=masterkey
(org.firebirdsql.jdbc.FBDriver)
url without encoding:
jdbc:firebirdsql:localhost:c:/fb2/db/TESTUTF8.fdb?user=sysdba&password=masterkey
(org.firebirdsql.jdbc.FBDriver)
This is so common mistake clients make and it varies per database what
to use if not all databases are UTF8 enabled. I have (tried)
programmed all programs as "point-to-point unicode/UTF8" applications.
Is it technically possible to make it all automatic, Java jdbc drivers
after all should give just unicodes due to java IS unicode already.
Or to have a special url parameter "encoding=auto" and client would
decide what to use based on a database default charset.
Probably most people use same encoding within a database and don't
change it per column.
Java clients should only give url
"jdbc:firebirdsql:localhost:c:/fb2/db/mydb.fdb?user=myuid&password=mypwd"
If that breaks old applications then using a new encoding value
"jdbc:firebirdsql:localhost:c:/fb2/db/mydb.fdb?encoding=auto&user=myuid&password=mypwd"
and expect to receive proper results.
columns. All is fine if clients know adding "encoding=UTF8" url
parameter before creating a connection.
But if some of the clients don't use it then application cannot
display values properly.
I have created a (very) simple query tool to test it:
http://koti.mbnet.fi/akini/fb/
url with encoding:
jdbc:firebirdsql:localhost:c:/fb2/db/TESTUTF8.fdb?encoding=UTF8&user=sysdba&password=masterkey
(org.firebirdsql.jdbc.FBDriver)
url without encoding:
jdbc:firebirdsql:localhost:c:/fb2/db/TESTUTF8.fdb?user=sysdba&password=masterkey
(org.firebirdsql.jdbc.FBDriver)
This is so common mistake clients make and it varies per database what
to use if not all databases are UTF8 enabled. I have (tried)
programmed all programs as "point-to-point unicode/UTF8" applications.
Is it technically possible to make it all automatic, Java jdbc drivers
after all should give just unicodes due to java IS unicode already.
Or to have a special url parameter "encoding=auto" and client would
decide what to use based on a database default charset.
Probably most people use same encoding within a database and don't
change it per column.
Java clients should only give url
"jdbc:firebirdsql:localhost:c:/fb2/db/mydb.fdb?user=myuid&password=mypwd"
If that breaks old applications then using a new encoding value
"jdbc:firebirdsql:localhost:c:/fb2/db/mydb.fdb?encoding=auto&user=myuid&password=mypwd"
and expect to receive proper results.