Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

Поиск
Список
Период
Сортировка
От Ivan Zolotukhin
Тема Best practice for: ERROR: invalid byte sequence for encoding "UTF8"
Дата
Msg-id 751e56400708150441i49402599re113a3470fbe26a0@mail.gmail.com
обсуждение исходный текст
Ответы Re: Best practice for: ERROR: invalid byte sequence for encoding "UTF8"  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Best practice for: ERROR: invalid byte sequence for encoding "UTF8"  ("Phoenix Kiula" <phoenix.kiula@gmail.com>)
Re: Best practice for: ERROR: invalid byte sequence for encoding "UTF8"  (Vivek Khera <vivek@khera.org>)
Список pgsql-general
Hello,

Imagine a web application that process text search queries from
clients. If one types a text search query in a browser it then sends
proper UTF-8 characters and application after all needed processing
(escaping, checks, etc) passes it to database. But if one modifies URL
of the query adding some trash non-UTF-8 characters, database raises
an error: invalid byte sequence for encoding "UTF8".

What is the best practice to process such a broken strings before
passing them to PostgreSQL? Iconv from utf-8 to utf-8 dropping bad
characters?

--
Regards,
 Ivan

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

Предыдущее
От: "Pavel Stehule"
Дата:
Сообщение: is this trigger safe and efective? - locking (caching via triiggers)
Следующее
От: "Dmitry Koterov"
Дата:
Сообщение: How to trap exceptions inside PL/Perl functions?