Re: Best practice for: ERROR: invalid byte sequence for encoding "UTF8" - Mailing list pgsql-general

From Phoenix Kiula
Subject Re: Best practice for: ERROR: invalid byte sequence for encoding "UTF8"
Date
Msg-id e373d31e0708150530q577cf085qdc05cbf55c6cb840@mail.gmail.com
Whole thread Raw
In response to Best practice for: ERROR: invalid byte sequence for encoding "UTF8"  ("Ivan Zolotukhin" <ivan.zolotukhin@gmail.com>)
Responses Re: Best practice for: ERROR: invalid byte sequence for encoding "UTF8"  ("Ivan Zolotukhin" <ivan.zolotukhin@gmail.com>)
List pgsql-general
On 15/08/07, Ivan Zolotukhin <ivan.zolotukhin@gmail.com> wrote:
> 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?



Could you do not do this from the application itself, before sending
it to the DB server? mb_convert_encoding() in PHP for instance?

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Best practice for: ERROR: invalid byte sequence for encoding "UTF8"
Next
From: "carter ck"
Date:
Subject: Re: Database Select Slow