agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
(no subject)
3+ messages / 3 participants
[nested] [flat]

* (no subject)
@ 2014-02-15 11:18  avpro avpro <avprowebeden@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: avpro avpro @ 2014-02-15 11:18 UTC (permalink / raw)
  To: pgsql-novice@postgresql.org <pgsql-novice@postgresql.org>; pgsql-sql

Hello all,

In postgresql 9.3 using pgAdmin, I created a table for my application
developed in Qt Creator.
the table contains:
idstudent - pk
name
country
town
street


I would like to import a csv file containing all the info about these
students. The file was saved/encoded in excel with UTF8 characters.

When I'm importing my file in psql, using the encoding UTF8, I receive the
following error for each character not recognized:
"error: invalid byte sequence for encoding "UTF8": ... " followed by the
character code

I tried to import the file using SQL_ASCII, I got similar errors.
I tried to import the file using MULE_INTERNAL and it worked, but the
characters not recognized are not shown correct in pdAdmin and in my
application when query is executed. For example after I imported the file
with LATIN1 all unrecognized characters were replaced with "?".

Any suggestion what encoding shall I use to display the characters
correctly?

note: the student's names and addresses are written using characters from
North Europe, Eastern EU, Russia, South America, Asia, etc. everywhere.

Thank you for your input.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re:
@ 2014-02-15 12:17  Gerald Cheves <gcheves@verizon.net>
  parent: avpro avpro <avprowebeden@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Gerald Cheves @ 2014-02-15 12:17 UTC (permalink / raw)
  To: pgsql-novice@postgresql.org <pgsql-novice@postgresql.org>

I had a similar problem. Try different encodings like this command:

set client_encoding to 'LATIN1';

Then:

COPY filename
FROM 'file/path/filename.csv'
WITH  DELIMITER ',' CSV HEADER;
On 2/15/2014 6:18 AM, avpro avpro wrote:
>
> Hello all,
>
> In postgresql 9.3 using pgAdmin, I created a table for my application 
> developed in Qt Creator.
> the table contains:
> idstudent - pk
> name
> country
> town
> street
>
>
> I would like to import a csv file containing all the info about these 
> students. The file was saved/encoded in excel with UTF8 characters.
>
> When I'm importing my file in psql, using the encoding UTF8, I receive 
> the following error for each character not recognized:
> "error: invalid byte sequence for encoding "UTF8": ... " followed by 
> the character code
>
> I tried to import the file using SQL_ASCII, I got similar errors.
> I tried to import the file using MULE_INTERNAL and it worked, but the 
> characters not recognized are not shown correct in pdAdmin and in my 
> application when query is executed. For example after I imported the 
> file with LATIN1 all unrecognized characters were replaced with "?".
>
> Any suggestion what encoding shall I use to display the characters 
> correctly?
>
> note: the student's names and addresses are written using characters 
> from North Europe, Eastern EU, Russia, South America, Asia, etc. 
> everywhere.
>
> Thank you for your input.


-- 
siamo arrivati sani e salvi



-- 
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re:
@ 2014-02-15 15:30  Adrian Klaver <adrian.klaver@gmail.com>
  parent: avpro avpro <avprowebeden@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2014-02-15 15:30 UTC (permalink / raw)
  To: avpro avpro <avprowebeden@gmail.com>; pgsql-novice@postgresql.org <pgsql-novice@postgresql.org>; pgsql-sql

On 02/15/2014 03:18 AM, avpro avpro wrote:
>
> Hello all,
>
> In postgresql 9.3 using pgAdmin, I created a table for my application
> developed in Qt Creator.
> the table contains:
> idstudent - pk
> name
> country
> town
> street
>
>
> I would like to import a csv file containing all the info about these
> students. The file was saved/encoded in excel with UTF8 characters.

You specified UTF8 when creating the CSV file?

>
> When I'm importing my file in psql, using the encoding UTF8, I receive
> the following error for each character not recognized:
> "error: invalid byte sequence for encoding "UTF8": ... " followed by the
> character code
>
> I tried to import the file using SQL_ASCII, I got similar errors.
> I tried to import the file using MULE_INTERNAL and it worked, but the
> characters not recognized are not shown correct in pdAdmin and in my
> application when query is executed. For example after I imported the
> file with LATIN1 all unrecognized characters were replaced with "?".
>
> Any suggestion what encoding shall I use to display the characters
> correctly?

Might want to take a look at this tool:

https://pypi.python.org/pypi/chardet


>
> note: the student's names and addresses are written using characters
> from North Europe, Eastern EU, Russia, South America, Asia, etc.
> everywhere.
>
> Thank you for your input.


-- 
Adrian Klaver
adrian.klaver@gmail.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2014-02-15 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-02-15 11:18  avpro avpro <avprowebeden@gmail.com>
2014-02-15 12:17 ` Re: Gerald Cheves <gcheves@verizon.net>
2014-02-15 15:30 ` Re: Adrian Klaver <adrian.klaver@gmail.com>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox