Re: BUG #3819: UTF8 can't handle \000

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Franklin Schmidt <fschmidt(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3819: UTF8 can't handle \000
Date: 2007-12-17 08:54:58
Message-ID: 200712170854.lBH8swh19036@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Franklin Schmidt wrote:
>
> The following bug has been logged online:
>
> Bug reference: 3819
> Logged by: Franklin Schmidt
> Email address: fschmidt(at)gmail(dot)com
> PostgreSQL version: 8.2
> Operating system: XP & Linux
> Description: UTF8 can't handle \000
> Details:
>
> Trying to store \000 in a text field with UTF8 encoding causes an error. I
> assume this is because Postgres is written in C, but it's still wrong. A
> solution was suggested here:
>
> http://www.nabble.com/invalid-byte-sequence-for-encoding-%22UTF8%22%3A-0x00-
> tp9058998p9096326.html
>
> "I can think of some ways the server could support it without extensive
> changes .. e.g. use a modified UTF8 representation which stores \u0000 as
> 0xc0 0x80 internally"

Uh, as far as I know 0x00 is not a valid UTF8 byte value. I suggest you
use bytea to store 0x00.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Franklin Schmidt 2007-12-17 09:23:14 Re: BUG #3819: UTF8 can't handle \000
Previous Message Sergey 2007-12-17 08:50:31 BUG #3820: auto-installer-failed