Обсуждение: Encoding problem

Поиск
Список
Период
Сортировка

Encoding problem

От
Pantelis Natsiavas
Дата:
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.

Re: Encoding problem

От
"Regász Imre"
Дата:
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.
>
>

Re: Encoding problem

От
Pantelis Natsiavas
Дата:
  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.

Re: Encoding problem

От
"Regász Imre"
Дата:
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.
>
>

Re: Encoding problem

От
Pantelis Natsiavas
Дата:
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.

Re: Encoding problem

От
Markus Schaber
Дата:
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

Re: Encoding problem

От
Pantelis Natsiavas
Дата:
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.

Re: Encoding problem

От
Markus Schaber
Дата:
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