0

After running osm2po on a pbf file for Europe I am importing the resulting files into a PostGIS and pgRouting enabled database. During the import psql it reporting many encoding errors because the WIN1252 found encoding has no equivalent in UTF8.

How can I solve that issue?

The initial pbf file was downloaded from GeoFabrik and osm2po used in the latest version available on Anitas webpage. PostgreSQL is in version 9.2, pgRouting is version 2.0

  • Which encoding has your PostgreSQL database? – dkastl Jul 8 '15 at 14:52
  • encoding of the database is UTF8 – Thomas Becker Jul 8 '15 at 16:54
  • Answer modifed. Error maybe found. – Carsten Jul 9 '15 at 11:40
1

Please make sure your database uses UTF-8 encoding.

And it seems there is a bug? in Postgres 9.4 which does not occur in older versions. Now you'll also have to modify your client encoding for psql. Well, you are using 9.2, but it might be the same issue.

https://dba.stackexchange.com/questions/71597/postgresql-set-default-psql-client-encoding

0

You have created a database in UTF-8 encoding, and you need write to the database data encoded WIN1252. Before you import, change the encoding of your database (‘prg’) on WIN1252.

Execute query: update pg_database set encoding = pg_char_to_encoding('win1252') where datname = 'pgr'

Import the map using OSM2PO. Change the character encoding of your database on UTF-8:

Execute query: update pg_database set encoding = pg_char_to_encoding('utf8') where datname = 'pgr'

I have used this method for encoding WIN1251->UTF8.

  • 1
    Hi, please note that in general answers on this site require some background information and explications. Please add some text that describes what these commands actually do. – Matthias Kuhn Oct 4 '15 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.