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

From: Vivek Khera <vivek(at)khera(dot)org>
To: "Ivan Zolotukhin" <ivan(dot)zolotukhin(at)gmail(dot)com>
Cc: "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Best practice for: ERROR: invalid byte sequence for encoding "UTF8"
Date: 2007-08-15 15:55:37
Message-ID: 911DB9B5-0FE3-45AB-9AF8-A379D049447C@khera.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Aug 15, 2007, at 7:41 AM, Ivan Zolotukhin wrote:

> 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?

This rings of GIGO... if your user enters garbage, how do you know
what they wanted? You don't. You tell them they entered garbage,
else the result will be garbage. Data validation... learn from
microsoft's mistakes :-)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Decibel! 2007-08-15 15:56:15 Re: Cluster and MVCC
Previous Message Tom Lane 2007-08-15 15:55:00 Re: Customizing psql console to show execution times