Re: \COPY to accept non UTF-8 chars in CHAR columns

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: \COPY to accept non UTF-8 chars in CHAR columns
Дата
Msg-id 87k135a2hd.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: \COPY to accept non UTF-8 chars in CHAR columns  (Thomas Munro <thomas.munro@gmail.com>)
Ответы Re: \COPY to accept non UTF-8 chars in CHAR columns
Список pgsql-general
>>>>> "Thomas" == Thomas Munro <thomas.munro@gmail.com> writes:

 Thomas> Something like this approach might be useful for fixing the CSV file:

 Thomas> https://codereview.stackexchange.com/questions/185821/convert-a-mix-of-latin-1-and-utf-8-to-proper-utf-8

Or:

perl -MEncode -pe '
 use bytes;
 sub c { decode("UTF-8",shift,sub { decode("windows-1252", chr(shift)) }); }
 s/([\x80-\xFF]+)/encode("UTF-8",c($1))/eg' <infile >outfile

-- 
Andrew (irc:RhodiumToad)



В списке pgsql-general по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: \COPY to accept non UTF-8 chars in CHAR columns
Следующее
От: Justin King
Дата:
Сообщение: Re: PG12 autovac issues