pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Encoding Problem
17+ messages / 8 participants
[nested] [flat]

* Encoding Problem
@ 2005-01-12 21:22 Jerome Colombie <jcolombie@gmx.ch>
  2005-01-12 21:52 ` Re: Encoding Problem Oliver Jowett <oliver@opencloud.com>
  2005-01-12 21:53 ` Re: Encoding Problem Kris Jurka <books@ejurka.com>
  0 siblings, 2 replies; 17+ messages in thread

From: Jerome Colombie @ 2005-01-12 21:22 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

I'm using Postgresql since the first 8.0 version (Windows2000) and it 
gets better with every new version. But one problem remains with the 
jdbc driver: The encoding of umlaute is still wrong. This problem occurs 
also in all pgAdmin III versions.
The psql client on the other hand works fine.
I tried different server encodings like sql_ascii or latin1 but I always 
get these strange characters in pgAdmin III and with jdbc. I also tried 
to specify the charSet property with the connection string in jdbc but 
that didn't help.
Does anyone know how I can get the correct strings with umlaut (e.g. 
ä,ö,ü) in java?
I thought this problem would be solved in the newer versions, but even 
in rc2 the problem still exists.

Greetings, Jérôme



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding Problem
  2005-01-12 21:22 Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
@ 2005-01-12 21:52 ` Oliver Jowett <oliver@opencloud.com>
  2005-01-12 22:04   ` Re: Encoding Problem Kris Jurka <books@ejurka.com>
  1 sibling, 1 reply; 17+ messages in thread

From: Oliver Jowett @ 2005-01-12 21:52 UTC (permalink / raw)
  To: Jerome Colombie <jcolombie@gmx.ch>; +Cc: pgsql-jdbc

Jerome Colombie wrote:

> I tried different server encodings like sql_ascii or latin1 but I always 
> get these strange characters in pgAdmin III and with jdbc. I also tried 
> to specify the charSet property with the connection string in jdbc but 
> that didn't help.
> Does anyone know how I can get the correct strings with umlaut (e.g. 
> ä,ö,ü) in java?
> I thought this problem would be solved in the newer versions, but even 
> in rc2 the problem still exists.

It should "just work" when using a server encoding of LATIN1 (I assume 
you can represent umlaut-ed characters in LATIN1?) or UNICODE.

Can you provide some example code that fails? Also, which driver version 
are you using?

-O



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding Problem
  2005-01-12 21:22 Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
  2005-01-12 21:52 ` Re: Encoding Problem Oliver Jowett <oliver@opencloud.com>
@ 2005-01-12 22:04   ` Kris Jurka <books@ejurka.com>
  2005-01-13 23:34     ` Re: Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
  0 siblings, 1 reply; 17+ messages in thread

From: Kris Jurka @ 2005-01-12 22:04 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: Jerome Colombie <jcolombie@gmx.ch>; pgsql-jdbc



On Thu, 13 Jan 2005, Oliver Jowett wrote:

> It should "just work" when using a server encoding of LATIN1 (I assume 
> you can represent umlaut-ed characters in LATIN1?) or UNICODE.
> 

Just an FYI, the windows version does not support unicode.  See:

http://pginstaller.projects.postgresql.org/FAQ_windows.html#2.6

Kris Jurka



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding Problem
  2005-01-12 21:22 Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
  2005-01-12 21:52 ` Re: Encoding Problem Oliver Jowett <oliver@opencloud.com>
  2005-01-12 22:04   ` Re: Encoding Problem Kris Jurka <books@ejurka.com>
@ 2005-01-13 23:34     ` Jerome Colombie <jcolombie@gmx.ch>
  2005-01-13 23:51       ` Re: Encoding Problem Kris Jurka <books@ejurka.com>
  2005-01-14 00:04       ` Re: Encoding Problem Oliver Jowett <oliver@opencloud.com>
  0 siblings, 2 replies; 17+ messages in thread

From: Jerome Colombie @ 2005-01-13 23:34 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc

Hi,

I made a low-level program which prints to the console. It seems that 
the jdbc driver is correct, although the Strings need some 
postprocessing in Java. I want to create html output, so I don't know if 
I have to change my windows settings, java settings (Locale) or just 
need to reformat the strings in java code.
My test program looks like this:

*********
bh=# create table test (
  t          VARCHAR(5)
);

bh=# insert into test values ('aäöü');

bh=# select * from test;
  t
------
 aäöü
(1 row)

bh=# select getdatabaseencoding();
 getdatabaseencoding
---------------------
 LATIN1
(1 row)

bh=# SHOW client_encoding;
 client_encoding
-----------------
 LATIN1
(1 row)

bh=# select version();
                                                version
--------------------------------------------------------------------------------------------------------
 PostgreSQL 8.0.0rc2 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 
3.3.1 (mingw special 20030804-1)
(1 row)
*********
import java.sql.*;
import java.util.Properties;

public class BaseDAO {
    protected static String dbHost = "localhost";
    protected static String dbUrl = "jdbc:postgresql://" + dbHost + 
":5432/bh";
    protected static String dbUser = "postgres";
    protected static String dbPassword = "***";
    protected static String dbDriver = "org.postgresql.Driver";

    static {
        //Register driver
        try {
            
DriverManager.registerDriver((Driver)Class.forName(dbDriver).newInstance());
        } catch (Exception e){
            System.out.println("Error: " + e);
        }
    }

    public BaseDAO() {
        super();
        try {
                Properties props = new Properties();
                props.put("user", dbUser);
                props.put("password", dbPassword);
                Connection con = DriverManager.getConnection(dbUrl, props);
                ResultSet rs = 
con.createStatement().executeQuery("select * from test");
                if (rs.next()) {
                    byte[] temp = rs.getString("t").getBytes();
              System.out.println("Database String");
              System.out.println(rs.getString("t"));
              System.out.println("Database Bytes");
              for (int i = 0; i < temp.length; i++) {
                  System.out.println(temp[i]);
              }
                }
      } catch(SQLException se) {
          System.out.println("Error: " + se);
        }
    }
   
    public static void main(String[] args) {
        BaseDAO dao = new BaseDAO();
        String test = "aäöü";
        System.out.println("Java String");
        System.out.println(test);
        System.out.println("Java Bytes");
        byte[] temp = test.getBytes();
        for (int i = 0; i < temp.length; i++) {
            System.out.println(temp[i]);
        }
        try {
            System.out.println("ISO-8859-1");
            String t1 = new String("aäöü".getBytes(), "ISO-8859-1");
            temp = t1.getBytes();
            for (int i = 0; i < temp.length; i++) {
                System.out.println(temp[i]);
            }
        } catch (java.io.UnsupportedEncodingException e) {
            System.out.println("Encoding exception: " + e);
        }
        try {
            System.out.println("UTF-8");
            String t1 = new String("aäöü".getBytes(), "UTF-8");
            temp = t1.getBytes();
            for (int i = 0; i < temp.length; i++) {
                System.out.println(temp[i]);
            }
        } catch (java.io.UnsupportedEncodingException e) {
            System.out.println("Encoding exception: " + e);
        }

    }
}
*********
D:\temp\test>javac BaseDAO.java

D:\temp\test>java -classpath d:\projects\jar\pg74.214.jdbc3.jar;. BaseDAO
Database String
a???
Database Bytes
97
63
63
63
Java String
aõ÷³
Java Bytes
97
-28
-10
-4
ISO-8859-1
97
-28
-10
-4
UTF-8
97
63
63
*********
How can I get the correct output in html with java code? I know that 
technically it hasn't got to do with jdbc but I still hope someone can 
give me a solution so I don't need to change the java code. I hope I can 
solve this problem by changing either the database configuration or the 
java or windows locale.

Regards, Jerome





^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding Problem
  2005-01-12 21:22 Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
  2005-01-12 21:52 ` Re: Encoding Problem Oliver Jowett <oliver@opencloud.com>
  2005-01-12 22:04   ` Re: Encoding Problem Kris Jurka <books@ejurka.com>
  2005-01-13 23:34     ` Re: Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
@ 2005-01-13 23:51       ` Kris Jurka <books@ejurka.com>
  1 sibling, 0 replies; 17+ messages in thread

From: Kris Jurka @ 2005-01-13 23:51 UTC (permalink / raw)
  To: Jerome Colombie <jcolombie@gmx.ch>; +Cc: Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc



On Fri, 14 Jan 2005, Jerome Colombie wrote:

> I made a low-level program which prints to the console. It seems that 
> the jdbc driver is correct, although the Strings need some 
> postprocessing in Java. I want to create html output, so I don't know if 
> I have to change my windows settings, java settings (Locale) or just 
> need to reformat the strings in java code.
> My test program looks like this:
> 

>             String t1 = new String("aäöü".getBytes(), "ISO-8859-1");
>             String t1 = new String("aäöü".getBytes(), "UTF-8");

At least one of these is clearly bogus.  I don't know what your default 
encoding is, but getBytes() will return data in that encoding, from there 
you are telling Java to interpret that one piece of data in two 
different ways, one of these must be wrong.

> How can I get the correct output in html with java code? I know that 
> technically it hasn't got to do with jdbc but I still hope someone can 
> give me a solution so I don't need to change the java code. I hope I can 
> solve this problem by changing either the database configuration or the 
> java or windows locale.
> 

To produce correctly encoded html, you need to ensure that your java 
environment's default encoding matches up with the encoding you have set 
for the page.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding Problem
  2005-01-12 21:22 Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
  2005-01-12 21:52 ` Re: Encoding Problem Oliver Jowett <oliver@opencloud.com>
  2005-01-12 22:04   ` Re: Encoding Problem Kris Jurka <books@ejurka.com>
  2005-01-13 23:34     ` Re: Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
@ 2005-01-14 00:04       ` Oliver Jowett <oliver@opencloud.com>
  1 sibling, 0 replies; 17+ messages in thread

From: Oliver Jowett @ 2005-01-14 00:04 UTC (permalink / raw)
  To: Jerome Colombie <jcolombie@gmx.ch>; +Cc: Kris Jurka <books@ejurka.com>; pgsql-jdbc

Jerome Colombie wrote:

>        byte[] temp = test.getBytes();

getBytes() uses the JVM's default encoding to convert from the internal 
string char[] representation, which might be wrong.

More interesting is test.getBytes("UTF-8") or test.getChars() or 
test.charAt(x)

-O



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding Problem
  2005-01-12 21:22 Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
@ 2005-01-12 21:53 ` Kris Jurka <books@ejurka.com>
  1 sibling, 0 replies; 17+ messages in thread

From: Kris Jurka @ 2005-01-12 21:53 UTC (permalink / raw)
  To: Jerome Colombie <jcolombie@gmx.ch>; +Cc: pgsql-jdbc



On Wed, 12 Jan 2005, Jerome Colombie wrote:

> I'm using Postgresql since the first 8.0 version (Windows2000) and it
> gets better with every new version. But one problem remains with the
> jdbc driver: The encoding of umlaute is still wrong. This problem occurs
> also in all pgAdmin III versions. The psql client on the other hand
> works fine. I tried different server encodings like sql_ascii or latin1
> but I always get these strange characters in pgAdmin III and with jdbc.

Note that pgadmin and jdbc are completely separate, so I can only speak 
for the java side of things.  For the pg jdbc driver you cannot use a 
database with sql_ascii encoding.  You must use a real encoding, latin1 
should be fine.

> I also tried to specify the charSet property with the connection string
> in jdbc but that didn't help.

If you read the documentation to find the charSet property you should have 
also seen the note that said this is completely ignored for server 
versions >= 7.3.

> Does anyone know how I can get the correct strings with umlaut (e.g.  
> ä,ö,ü) in java? I thought this problem would be solved in the newer
> versions, but even in rc2 the problem still exists.
> 

I have no reason to believe there is a problem with the server/jdbc 
encoding handling.  I would suspect the problem is related to how you are 
trying to enter/display these values.  If you can reproduce this problem 
with a standalone Java program that runs against a non sql-ascii database 
and does direct string comparisons (doesn't rely on things like 
System.out.println), then please post such a program here.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Encoding problem
@ 2006-08-30 08:35 Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-30 08:44 ` Re: Encoding problem Regász Imre <linimi@gmail.com>
  0 siblings, 1 reply; 17+ messages in thread

From: Pantelis Natsiavas @ 2006-08-30 08:35 UTC (permalink / raw)
  To: pgsql-jdbc

Hello, 
      I am really new to PostgreSQL and I seem to have an  encoding problem. I come from Greece and I would like to make queries  using greek characters too. I chose to write my database using encoding  UTF8 and everything worked just fine creating it, until I tried to make  a query using greek characters.
      I tried to make the query through JDBC but this was impossible, receiving a message saying :
                             relation "??????????" does not exist
  where the relation's name is in greek characters. Despite fact that the  relation is normally created, named and filled using greek characters,  I could not make the query. In addition trying to make the same query  through the query tool of pgadmin, I receive the same answer and of  course null results.
      I don't know if it matters, but I am using Windows  XP and PostgreSQL 8.1 with JDBC 3. I have checked everything that has  to do with the java part of encoding and I cannot find anything wrong.  The fact that I could not make the query through the pgadmin query  tool, shows that the problem lays at the PostgreSQL part.
      What could I do? Can anyone help me?
  
  Thank you in advance,
  Natsiavas Pantelis
  
 		
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding problem
  2006-08-30 08:35 Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
@ 2006-08-30 08:44 ` Regász Imre <linimi@gmail.com>
  2006-08-30 09:42   ` Re: Encoding problem Regász Imre <linimi@gmail.com>
  0 siblings, 1 reply; 17+ messages in thread

From: Regász Imre @ 2006-08-30 08:44 UTC (permalink / raw)
  To: Pantelis Natsiavas <pantelykos@yahoo.com>; +Cc: pgsql-jdbc

Hi,

Is there table name in java source file? What is the encoding of java
source file?

Imi

On 8/30/06, Pantelis Natsiavas <pantelykos@yahoo.com> wrote:
> Hello,
>      I am really new to PostgreSQL and I seem to have an encoding problem. I
> come from Greece and I would like to make queries using greek characters
> too. I chose to write my database using encoding UTF8 and everything worked
> just fine creating it, until I tried to make a query using greek characters.
>      I tried to make the query through JDBC but this was impossible,
> receiving a message saying :
>                            relation "??????????" does not exist
>  where the relation's name is in greek characters. Despite fact that the
> relation is normally created, named and filled using greek characters, I
> could not make the query. In addition trying to make the same query through
> the query tool of pgadmin, I receive the same answer and of course null
> results.
>      I don't know if it matters, but I am using Windows XP and PostgreSQL
> 8.1 with JDBC 3. I have checked everything that has to do with the java part
> of encoding and I cannot find anything wrong. The fact that I could not make
> the query through the pgadmin query tool, shows that the problem lays at the
> PostgreSQL part.
>      What could I do? Can anyone help me?
>
>  Thank you in advance,
>  Natsiavas Pantelis
>
>
>  ________________________________
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
> countries) for 2¢/min or less.
>
>



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding problem
  2006-08-30 08:35 Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-30 08:44 ` Re: Encoding problem Regász Imre <linimi@gmail.com>
@ 2006-08-30 09:42   ` Regász Imre <linimi@gmail.com>
  2006-08-30 10:09     ` Re: Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
  0 siblings, 1 reply; 17+ messages in thread

From: Regász Imre @ 2006-08-30 09:42 UTC (permalink / raw)
  To: Pantelis Natsiavas <pantelykos@yahoo.com>; +Cc: pgsql-jdbc

How do you create the table? Which tool?
Can you create the table with java code over jdbc?

I think if you create table with java code and run query with java
code then everithing will ok I think.

(Sorry, my english is not too good.)

Imi

On 8/30/06, Pantelis Natsiavas <pantelykos@yahoo.com> wrote:
>     I am not really sure, about what you are asking. I am writing in
> JBuilder. I tried to use the default encoding in JBuilder project and I got
> the same error. Then tried to change it to UTF-8 but still nothing. I think
> that this should be the encoding of the source file. I don't understand why
> I should have the table name in the java source file.
>      I create only a String object which contains the SQL query and works
> fine with english-named tables. The String containing the SQL query is
> encoded in UTF-8 but it doesn't work when I use greek characters. I ensist
> that the problem should be in PostgreSQL settings and not in my code,
> because I tried to make the same query through the query tool in pgadmin and
> I got the same error. I even tried, to save the query in Windows Notepad
> using UTF-8 and then load it through the proper option in the query tool of
> pgadmin and still the same error occurs.
>
>  Always thankful,
>  Pantelis
>
>
> Regász Imre <linimi@gmail.com> wrote:
>
>  Hi,
>
> Is there table name in java source file? What is the encoding of java
> source file?
>
> Imi
>
> On 8/30/06, Pantelis Natsiavas wrote:
> > Hello,
> > I am really new to PostgreSQL and I seem to have an encoding problem. I
> > come from Greece and I would like to make queries using greek characters
> > too. I chose to write my database using encoding UTF8 and everything
> worked
> > just fine creating it, until I tried to make a query using greek
> characters.
> > I tried to make the query through JDBC but this was impossible,
> > receiving a message saying :
> > relation "??????????" does not exist
> > where the relation's name is in greek characters. Despite fact that the
> > relation is normally created, named and filled using greek characters, I
> > could not make the query. In addition trying to make the same query
> through
> > the query tool of pgadmin, I receive the same answer and of course null
> > results.
> > I don't know if it matters, but I am using Windows XP and PostgreSQL
> > 8.1 with JDBC 3. I have checked everything that has to do with the java
> part
> > of encoding and I cannot find anything wrong. The fact that I could not
> make
> > the query through the pgadmin query tool, shows that the problem lays at
> the
> > PostgreSQL part.
> > What could I do? Can anyone help me?
> >
> > Thank you in advance,
> > Natsiavas Pantelis
> >
> >
> > ________________________________
> > Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
> > countries) for 2¢/min or less.
> >
> >
>
>
>
>
>  ________________________________
> Do you Yahoo!?
>  Next-gen email? Have it all with the all-new Yahoo! Mail.
>
>



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding problem
  2006-08-30 08:35 Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-30 08:44 ` Re: Encoding problem Regász Imre <linimi@gmail.com>
  2006-08-30 09:42   ` Re: Encoding problem Regász Imre <linimi@gmail.com>
@ 2006-08-30 10:09     ` Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-30 11:06       ` Re: Encoding problem Markus Schaber <schabi@logix-tt.com>
  0 siblings, 1 reply; 17+ messages in thread

From: Pantelis Natsiavas @ 2006-08-30 10:09 UTC (permalink / raw)
  To: pgsql-jdbc

The whole database is created using the pgadmin tool, and I write greek  characters simply through this. I do not know if that's the proper way  to do it. Do youu think, that perhaps the default Windows charset is  somehow involved in this process? How could this be possible when my  database has a UTF8 encoding? 
  The problem is, that I cannot make a SELECT query through the pgadmin  tool or the JDBC, using the same greek characters! That's why I think,  this may not be a JDBC problem, after all. My application does not  involve creating a table or a database, just querying it. I will try to  create a table through JDBC, using greek characters for naming it and  post an email, just to be in the archives of the list.
  
  I am gratefull for your time. I really appreciate it.
  Pantelis
  

  
Regász Imre <linimi@gmail.com> wrote:  How do you create the table? Which tool?
Can you create the table with java code over jdbc?

I think if you create table with java code and run query with java
code then everithing will ok I think.

(Sorry, my english is not too good.)

Imi

On 8/30/06, Pantelis Natsiavas 
 wrote:
>     I am not really sure, about what you are asking. I am writing in
> JBuilder. I tried to use the default encoding in JBuilder project and I got
> the same error. Then tried to change it to UTF-8 but still nothing. I think
> that this should be the encoding of the source file. I don't understand why
> I should have the table name in the java source file.
>      I create only a String object which contains the SQL query and works
> fine with english-named tables. The String containing the SQL query is
> encoded in UTF-8 but it doesn't work when I use greek characters. I ensist
> that the problem should be in PostgreSQL settings and not in my code,
> because I tried to make the same query through the query tool in pgadmin and
> I got the same error. I even tried, to save the query in Windows Notepad
> using UTF-8 and then load it through the proper option in the query tool of
> pgadmin and still the same error occurs.
>
>  Always thankful,
>  Pantelis
>
>
> Regász Imre 
 wrote:
>
>  Hi,
>
> Is there table name in java source file? What is the encoding of java
> source file?
>
> Imi
>
> On 8/30/06, Pantelis Natsiavas wrote:
> > Hello,
> > I am really new to PostgreSQL and I seem to have an encoding problem. I
> > come from Greece and I would like to make queries using greek characters
> > too. I chose to write my database using encoding UTF8 and everything
> worked
> > just fine creating it, until I tried to make a query using greek
> characters.
> > I tried to make the query through JDBC but this was impossible,
> > receiving a message saying :
> > relation "??????????" does not exist
> > where the relation's name is in greek characters. Despite fact that the
> > relation is normally created, named and filled using greek characters, I
> > could not make the query. In addition trying to make the same query
> through
> > the query tool of pgadmin, I receive the same answer and of course null
> > results.
> > I don't know if it matters, but I am using Windows XP and PostgreSQL
> > 8.1 with JDBC 3. I have checked everything that has to do with the java
> part
> > of encoding and I cannot find anything wrong. The fact that I could not
> make
> > the query through the pgadmin query tool, shows that the problem lays at
> the
> > PostgreSQL part.
> > What could I do? Can anyone help me?
> >
> > Thank you in advance,
> > Natsiavas Pantelis
> >
> >
> > ________________________________
> > Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
> > countries) for 2¢/min or less.
> >
> >
>
>
>
>
>  ________________________________
> Do you Yahoo!?
>  Next-gen email? Have it all with the all-new Yahoo! Mail.
>
>

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings



 		
---------------------------------
 All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding problem
  2006-08-30 08:35 Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-30 08:44 ` Re: Encoding problem Regász Imre <linimi@gmail.com>
  2006-08-30 09:42   ` Re: Encoding problem Regász Imre <linimi@gmail.com>
  2006-08-30 10:09     ` Re: Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
@ 2006-08-30 11:06       ` Markus Schaber <schabi@logix-tt.com>
  2006-08-31 16:19         ` Re: Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
  0 siblings, 1 reply; 17+ messages in thread

From: Markus Schaber @ 2006-08-30 11:06 UTC (permalink / raw)
  To: Pantelis Natsiavas <pantelykos@yahoo.com>; +Cc: pgsql-jdbc

Hi, Pantelis,

Pantelis Natsiavas wrote:

> The problem is, that I cannot make a SELECT query through the pgadmin
> tool or the JDBC, using the same greek characters!

Have you tried quoting the table names in double quotes? Like in:

SELECT * FROM "myGreekTable";

Quoted identifiers are a source of trouble in SQL databases...

HTH,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding problem
  2006-08-30 08:35 Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-30 08:44 ` Re: Encoding problem Regász Imre <linimi@gmail.com>
  2006-08-30 09:42   ` Re: Encoding problem Regász Imre <linimi@gmail.com>
  2006-08-30 10:09     ` Re: Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-30 11:06       ` Re: Encoding problem Markus Schaber <schabi@logix-tt.com>
@ 2006-08-31 16:19         ` Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-31 16:37           ` Re: Encoding problem Markus Schaber <schabi@logix-tt.com>
  0 siblings, 1 reply; 17+ messages in thread

From: Pantelis Natsiavas @ 2006-08-31 16:19 UTC (permalink / raw)
  To: pgsql-jdbc

Thank you Markus. It is unbelievable! I 've lost two days breaking my  head over encodings, and the solution was the double quotes!
  
  Thank you all for bothering,
  Pantelis
  
  

Markus Schaber <schabi@logix-tt.com> wrote:  Hi, Pantelis,

Pantelis Natsiavas wrote:

> The problem is, that I cannot make a SELECT query through the pgadmin
> tool or the JDBC, using the same greek characters!

Have you tried quoting the table names in double quotes? Like in:

SELECT * FROM "myGreekTable";

Quoted identifiers are a source of trouble in SQL databases...

HTH,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


 		
---------------------------------
Ring'em or ping'em. Make  PC-to-phone calls as low as 1¢/min with Yahoo! Messenger with Voice.

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding problem
  2006-08-30 08:35 Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-30 08:44 ` Re: Encoding problem Regász Imre <linimi@gmail.com>
  2006-08-30 09:42   ` Re: Encoding problem Regász Imre <linimi@gmail.com>
  2006-08-30 10:09     ` Re: Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
  2006-08-30 11:06       ` Re: Encoding problem Markus Schaber <schabi@logix-tt.com>
  2006-08-31 16:19         ` Re: Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
@ 2006-08-31 16:37           ` Markus Schaber <schabi@logix-tt.com>
  0 siblings, 0 replies; 17+ messages in thread

From: Markus Schaber @ 2006-08-31 16:37 UTC (permalink / raw)
  To: pgsql-jdbc

Hi, Pantelis,

Pantelis Natsiavas wrote:
> Thank you Markus. It is unbelievable! I 've lost two days breaking my
> head over encodings, and the solution was the double quotes!

Glad I could help you.

I think that, during table creation, pgadmin submitted the identifiers
in quoted form.

http://www.postgresql.org/docs/8.1/interactive/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS
might be an interesting read, too.


Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org



^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding problem
@ 2006-08-30 09:14 Pantelis Natsiavas <pantelykos@yahoo.com>
  0 siblings, 0 replies; 17+ messages in thread

From: Pantelis Natsiavas @ 2006-08-30 09:14 UTC (permalink / raw)
  To: pgsql-jdbc

  I am not really sure, about what you are asking. I am writing in  JBuilder. I tried to use the default encoding in JBuilder project and I  got the same error. Then tried to change it to UTF-8 but still nothing.  I think that this should be the encoding of the source file. I don't  understand why I should have the table name in the java source file. 
        I create only a String object which contains the SQL query and  works fine with english-named tables. The String containing the SQL  query is encoded in UTF-8 but it doesn't work when I use greek  characters. I ensist that the problem should be in PostgreSQL settings  and not in my code, because I tried to make the same query through the  query tool in pgadmin and I got the same error. I even tried, to save  the query in Windows Notepad using UTF-8 and then load it through the  proper option in the query tool of pgadmin and still the same error  occurs.
    
    Always thankful,
      Pantelis 
 		
---------------------------------
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail.

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Encoding Problem
@ 2006-08-30 15:53 meil parachorras <meilparachorras@hotmail.com>
  2006-08-31 08:44 ` Re: Encoding Problem Marc Herbert <Marc.Herbert@continuent.com>
  0 siblings, 1 reply; 17+ messages in thread

From: meil parachorras @ 2006-08-30 15:53 UTC (permalink / raw)
  To: pgsql-jdbc

Hello.

I have a problem with JDBC and PostgreSQL.

Example:
Class.forName("org.postgresql.Driver");
String url = "jdbc:postgresql://localhost:5432/GE";
Connection con = DriverManager.getConnection(url,"user","pass");
Statement st = con.createStatement();
sql = "INSERT INTO Auffinden VALUES ('1','München');";
ResultSet res = st.executeQuery(sql);
con.close();

And I receive this error:
org.postgresql.util.PSQLException: ERROR: character 0xc383 of encoding 
"UTF8" has no equivalent in "ISO_8859_5".

How can I data with encoding ISO_8859_5 with JDBC senden?

I use the drivers: postgresql-8.1-405.jdbc2.jar with postgresql 8.1 and JDK 
5.0.

Best regards,
Michael.

_________________________________________________________________
Descarga gratis la Barra de Herramientas de MSN 
http://www.msn.es/usuario/busqueda/barra?XAPID=2031&DI=1055&SU=http%3A//www.hotmail.com&...




^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: Encoding Problem
  2006-08-30 15:53 Encoding Problem meil parachorras <meilparachorras@hotmail.com>
@ 2006-08-31 08:44 ` Marc Herbert <Marc.Herbert@continuent.com>
  0 siblings, 0 replies; 17+ messages in thread

From: Marc Herbert @ 2006-08-31 08:44 UTC (permalink / raw)
  To: pgsql-jdbc

"meil parachorras" <meilparachorras@hotmail.com> writes:

> Example:
> Class.forName("org.postgresql.Driver");
> String url = "jdbc:postgresql://localhost:5432/GE";
> Connection con = DriverManager.getConnection(url,"user","pass");
> Statement st = con.createStatement();
> sql = "INSERT INTO Auffinden VALUES ('1','München');";
> ResultSet res = st.executeQuery(sql);
> con.close();
>
> And I receive this error:
> org.postgresql.util.PSQLException: ERROR: character 0xc383 of encoding
> "UTF8" has no equivalent in "ISO_8859_5".

You configured your database with a cyrillic alphabet. The error
message just means that ü (u umlaut) does not exist in this cyrillic
alphabet, you cannot write this character in cyrillic. This is NOT an
encoding issue, it's a charset issue: this character does not exist in
this charset, so there is no way you can insert it, whatever the
encoding(s).

<http://czyborra.com/charsets/iso8859.html#ISO-8859-5;

You'll easily find more detailed explanations if you search the web.


> How can I data with encoding ISO_8859_5 with JDBC senden?

?




^ permalink  raw  reply  [nested|flat] 17+ messages in thread


end of thread, other threads:[~2006-08-31 16:37 UTC | newest]

Thread overview: 17+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-12 21:22 Encoding Problem Jerome Colombie <jcolombie@gmx.ch>
2005-01-12 21:52 ` Oliver Jowett <oliver@opencloud.com>
2005-01-12 22:04   ` Kris Jurka <books@ejurka.com>
2005-01-13 23:34     ` Jerome Colombie <jcolombie@gmx.ch>
2005-01-13 23:51       ` Kris Jurka <books@ejurka.com>
2005-01-14 00:04       ` Oliver Jowett <oliver@opencloud.com>
2005-01-12 21:53 ` Kris Jurka <books@ejurka.com>
2006-08-30 08:35 Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
2006-08-30 08:44 ` Re: Encoding problem Regász Imre <linimi@gmail.com>
2006-08-30 09:42   ` Re: Encoding problem Regász Imre <linimi@gmail.com>
2006-08-30 10:09     ` Re: Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
2006-08-30 11:06       ` Re: Encoding problem Markus Schaber <schabi@logix-tt.com>
2006-08-31 16:19         ` Re: Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
2006-08-31 16:37           ` Re: Encoding problem Markus Schaber <schabi@logix-tt.com>
2006-08-30 09:14 Re: Encoding problem Pantelis Natsiavas <pantelykos@yahoo.com>
2006-08-30 15:53 Encoding Problem meil parachorras <meilparachorras@hotmail.com>
2006-08-31 08:44 ` Marc Herbert <Marc.Herbert@continuent.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox