Thread: problem inserting local characters ...
Hi, I'm running PostGreSql 7.4.6 on SuSE 9.1. Everything as such is working fine. In order to import some data from an old system, I create an SQL script that does something like: insert into prg_contacts values ('2005-02-22 13:45:36+01','NETHINKS Converter',NULL,NULL,'admin','s', NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL, NULL,'Anrede','Titel','Vorname', NULL,'Firmenname','TelefonGeschäft','Faxnr', 'TelefonMobil','email@email.de',NULL,NULL, 'SMS-Pager','2.email@email.de','Firmenland','FirmenOrt', 'FirmenPLZ',NULL,'Firmenbundesland','Firmenstraße', NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL, [..] Trying to do this insert, I get an error on both the values "TelefonGeschäft" and "Firmenstraße": FEHLER: ungültige Byte-Sequenz für Kodierung »UNICODE«: 0xe165 (the 0xe165 differs between the two; the fields in question are regular type "text" fields) Looks like I'm having some trouble with unicode encoding ... The characters I have are regular 8bit ASCII chars ... How can I fix this? Help appreciated, -gg
Hi, Garry, Garry schrieb: > Trying to do this insert, I get an error on both the values > "TelefonGeschäft" and "Firmenstraße": > > FEHLER: ungültige Byte-Sequenz für Kodierung »UNICODE«: 0xe165 This sounds as your database was created in unicode (utf-8). > (the 0xe165 differs between the two; the fields in question are regular > type "text" fields) > > Looks like I'm having some trouble with unicode encoding ... The > characters I have are regular 8bit ASCII chars ... How can I fix this? No, 8bit ASCII does not exist. ASCII always is 7 bit. As your error message is in German, I suspect your data is encoded in LATIN1 or LATIN9 (their only difference is the EUR symbol in the latter one). Can you try to add the following command before your insert statements: set client_encoding to latin1; HTH, Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 zürich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com
I had a similar problem myself and found if I used SQL_ASCHII for the data base I could insert my data. I understand however that it basically means the database does not know anything about encoding and therefore stuff like upper does not work on the extended chars. I ended up changing to sql_aschii so both my inserts and backup and restore work, realizing I am giving up some functionality. Joel Fradkin Wazagua, Inc. 2520 Trailmate Dr Sarasota, Florida 34243 Tel. 941-753-7111 ext 305 jfradkin@wazagua.com www.wazagua.com Powered by Wazagua Providing you with the latest Web-based technology & advanced tools. © 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, IncThis email message is for the use of the intended recipient(s) andmay contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and delete and destroy all copies of the original message, including attachments. -----Original Message----- From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Markus Schaber Sent: Tuesday, February 22, 2005 8:41 AM To: Garry Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] problem inserting local characters ... Hi, Garry, Garry schrieb: > Trying to do this insert, I get an error on both the values > "TelefonGeschäft" and "Firmenstraße": > > FEHLER: ungültige Byte-Sequenz für Kodierung »UNICODE«: 0xe165 This sounds as your database was created in unicode (utf-8). > (the 0xe165 differs between the two; the fields in question are regular > type "text" fields) > > Looks like I'm having some trouble with unicode encoding ... The > characters I have are regular 8bit ASCII chars ... How can I fix this? No, 8bit ASCII does not exist. ASCII always is 7 bit. As your error message is in German, I suspect your data is encoded in LATIN1 or LATIN9 (their only difference is the EUR symbol in the latter one). Can you try to add the following command before your insert statements: set client_encoding to latin1; HTH, Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 zürich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com