importing from a file with UTF-8 escape characters

From: Seb <spluque(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: importing from a file with UTF-8 escape characters
Date: 2010-02-09 05:06:30
Message-ID: 873a1b80bt.fsf@kolob.sebmags.homelinux.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm trying to import the geonames table from
http://download.geonames.org/export/dump/allCountries.zip. A PostgreSQL
user recommended using:

create table geonames (
geonameid int,
name varchar(200),
asciiname varchar(200),
alternatenames varchar(4000),
latitude float,
longitude float,
fclass char(1),
fcode varchar(10),
country varchar(2),
cc2 varchar(60),
admin1 varchar(20),
admin2 varchar(80),
admin3 varchar(20),
admin4 varchar(20),
population bigint,
elevation int,
gtopo30 int,
timezone varchar(40),
moddate date
);

but some lines in the file have strings of the form:

5881673 {1}útsaw Lake {1}utsaw Lake 62.699499389 -136.737319993 H LK CA 12 0 600 America/Dawson 2006-01-18

which I take as UTF-8 escaped characters. Any tips on how to import
this into the table so that they print properly? Thanks.

Cheers,

--
Seb

Browse pgsql-general by date

  From Date Subject
Next Message Ben Chobot 2010-02-09 05:08:52 Re: questions about a table's row estimates
Previous Message Ben Chobot 2010-02-09 05:04:46 Re: pg_stat_user_indexes and pg_stat_user_tables description?