Good morning I have created a database to store all the countries and cities and I am trying to load the data but even though my database is created with a utf-8 file like my tables. At the time of importing I also select UTF-8 but it gives me error of this type ERROR: invalid byte sequence for encoding "UTF8": 0xe3 0x6f 0x20
CONTEXT: COPY ciudades, line 23488
simply by receiving an accent, a ñ or any other special character. Any guidance that can help me would be grateful.
Next the SQL code:
-- Database: paises
-- DROP DATABASE paises;
CREATE DATABASE paises
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
-- La configuracion de la tabla
-- Table: public.ciudades
-- DROP TABLE public.ciudades;
CREATE TABLE public.ciudades
(
id_ciudad bigint NOT NULL,
id_pais_ciudad character varying(10) COLLATE pg_catalog."default" NOT NULL,
nom_ciudad character varying(100) COLLATE pg_catalog."default",
CONSTRAINT ciudades_pkey PRIMARY KEY (id_ciudad),
CONSTRAINT id_pais_ciudad FOREIGN KEY (id_pais_ciudad)
REFERENCES public.paises (cod_pais) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.ciudades
OWNER to postgres;