Skip site navigation (1) Skip section navigation (2)

A question about postgresql 8.1 and UTF strings

From: "Yair Zas" <yair(dot)zaslavsky(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: A question about postgresql 8.1 and UTF strings
Date: 2006-06-18 08:10:46
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Good day all,
I have postgresql 8.1 (on WINXP service pack 2).
I have a table t_users with the columns id (serial),  username (
varchar(256) ), and password ( varchar(256) )
The database was created with UT8 encoding.
I have 5 users at the database, and some of them have non-latin (especially
hebrew) usernames, i entered these non latin values simply by using the
pgadmin gui (was i correct to do so?) to enter the non-latin strings.
I opened a jdbc connection using a standard postgres JDBC URL and selected a
recordset with a hebrew username.
I used String user = ResultSet.GetString("username") to get the String
(which contains 4 hebrew letters)
and then I used

System.out.println(user.getBytes().length) - however, instead of seeing 8
bytes (2 bytes per each character, 4 characters ), i saw 4 bytes ....
Can you please tell me what is it that I'm doing wrong?




pgsql-jdbc by date

Next:From: Oliver JowettDate: 2006-06-18 08:25:53
Subject: Re: A question about postgresql 8.1 and UTF strings
Previous:From: Oliver JowettDate: 2006-06-18 06:03:00
Subject: Re: Meta Information about columns of a domain datatype ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group