473,493 Members | 4,355 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

unicode and varchar

Hi all,

I have a problem when inserting into a varchar field via jdbc.

Using to bytes makes the varchar fields shorten.

Example: with 7.4.5. on Linux

create table test(charfield varchar(5));
insert into test(charfield) values('abcde');
insert into test(charfield) values('üö');

select bit_length(charfield), length(charfield), charfield from test

bit_length length charfield
------------- --------- ------------
40 5 abcde
32 4 üö

insert into test(charfield) values('üäö');
Error: ERROR: value too long for type character varying(5)

Doing the same on Windows with the fresh 8.0 beta 2 shows a different
behaviour.
create table test(charfield varchar(5));
insert into test(charfield) values('abcde');
insert into test(charfield) values('üöüöä');

select bit_length(charfield), length(charfield), charfield from test

bit_length length charfield
------------- --------- ------------
40 5 abcde
80 5 üöüöä

'length' seems to account the 16 bit character length.
Is there a way to make this work in 7.4.x too?
May problem is that we are in a rush to do a port of our application
from informix and I will not be able to wait until 8.0 will be released.

BTW, both database servers where queried with the same JDBC driver
(version).

Best regards,

Michael
Nov 23 '05 #1
2 2692
On Fri, 10 Sep 2004 14:57:18 +0200, Michael Wimmer <ne********@ecom.at> wrote:
(...)
Is there a way to make this work in 7.4.x too?
May problem is that we are in a rush to do a port of our application
from informix and I will not be able to wait until 8.0 will be released.


What encoding does the 7.4.x database have?

Ian Barwick

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
Thanks for bringing me on the track.

I recreated the database with encoding=utf8 and downloaded the latest
build of the driver (215). Both together made it work.

Best regards,

Michael

Ian Barwick wrote:
On Fri, 10 Sep 2004 14:57:18 +0200, Michael Wimmer <ne********@ecom.at> wrote:
(...)
Is there a way to make this work in 7.4.x too?
May problem is that we are in a rush to do a port of our application
from informix and I will not be able to wait until 8.0 will be released.

What encoding does the 7.4.x database have?

Ian Barwick

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5032
by: sinasalek | last post by:
i have a problem with MySQL 4.1.x and UTF8. in version 4.0, i'm using html forms with utf8 charset for inserting unicode strings. but in version 4.1.x it is not working! if i change the charset of...
2
3583
by: Rene Pijlman | last post by:
I can't seem to find any way to specify the character encoding with the DB API implementation of PyPgSQL. There is no mention of encoding and Unicode in the DB API v2.0 spec and the PyPgSQL README....
8
5250
by: Bill Eldridge | last post by:
I'm trying to grab a document off the Web and toss it into a MySQL database, but I keep running into the various encoding problems with Unicode (that aren't a problem for me with GB2312, BIG 5,...
2
9750
by: Bernd Lambertz | last post by:
I have a problem with bcp and format files. We changed our databases from varchar to nvarchar to support unicode. No problems so fare with that. It is working fine. But now I need a format...
2
7786
by: Rodger Dodger | last post by:
Hi there. We have an application that can run on a non-unicode or a unicode sql server database. Currently the application is running in a unicode database, as a non-unicode database is less...
0
1300
by: Antonio Gallardo | last post by:
psql returns: Invalid UNICODE character sequence found(0xc000) in a valid query. Steps to reproduce: 1. createdb -E UNICODE mydbname. 2. create a table with some varchar inside, we will...
1
4830
by: jrs_14618 | last post by:
Hello All, This post is essentially a reply a previous post/thread here on this mailing.database.myodbc group titled: MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode I was...
1
8314
by: willie | last post by:
>willie wrote: wrote:
1
3845
by: Mudcat | last post by:
In short what I'm trying to do is read a document using an xml parser and then upload that data back into a database. I've got the code more or less completed using xml.etree.ElementTree for the...
0
1212
by: aj | last post by:
SQL Server 2005 64-bit 9.00.3042 SP2 I am migrating a database to SQL Server that is not unicode... Assuming that I have no plan to store different languages (other than English), does it make...
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.