473,811 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ 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(char field), length(charfiel d), 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(char field), length(charfiel d), 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 2715
On Fri, 10 Sep 2004 14:57:18 +0200, Michael Wimmer <ne********@eco m.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********@eco m.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
5047
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 column, ALTER TABLE `icons` CHANGE `name_farsi` `name_farsi` VARCHAR( 99 ) CHARACTER SET utf8 COLLATE utf8_persian_ci DEFAULT NULL and change default charset of database like below code :
2
3606
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. When I have Unicode strings in Python and store it in a PostgreSQL Unicode database, will the data automatically be correctly encoded? Or do I need to specify the UTF-8 client encoding on the database connection somehow? I'm using the...
8
5281
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, etc.) What I'd like is something as simple as: CREATE TABLE junk (junklet VARCHAR(2500) CHARACTER SET UTF8)); import MySQLdb, re,urllib
2
9766
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 file for the customer table and and it is not working. It is working fine with the old DB with varchar, but with nvarchar I'm not able to copy the data. The biggest problem is, that I got no error message. BCP starts copying to table and finished...
2
7805
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 than half the size, I would prefer to have a non-unicode database for demo purposes to be on my laptop, etc etc
0
1313
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 query on this field. Example:
1
4859
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 wondering if anybody has experienced the same issues
1
8389
by: willie | last post by:
>willie wrote: wrote:
1
3864
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 parser and dbi/ odbc for my db connection. To fix problems with unicode I built a work-around by mapping unicode characters to equivalent ascii characters and then encoding everything to ascii. That allowed me to build the application and debug...
0
1227
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 sense to change my char() -nchar() and my varchar() -nvarchar()? My collation is sql_latin1_general_cp1_ci_as. Is there any relationship between the collation and unicode support? I see that I can alter
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10652
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7673
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6895
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4346
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 we have to send another system

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.