Re: Bug with UTF-8 character

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org, eg(at)cybertec(dot)at
Subject: Re: Bug with UTF-8 character
Date: 2006-05-26 13:48:33
Message-ID: 20060526134833.GC27513@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 26, 2006 at 08:21:56AM +0200, Hans-Jürgen Schönig wrote:
> good morning,
>
> I got a bug request for the following unicode character in PostgreSQL
> 8.1.4: 0xedaeb8
>
> ERROR: invalid byte sequence for encoding "UTF8": 0xedaeb8
>
> This one seemed to work properly in PostgreSQL 8.0.3.
>
> I think the following code in postgreSQL 814 has a bug in it.
>
> File: postgresql-8.1.4/src/backend/utils/mb/wchar.c

Your character converts to char DBB8. According to the standard,
characters in the range D800-DFFF are not characters but surrogates.
They don't mean anything by themselves and are thus rejected by
postgres.

http://www.unicode.org/faq/utf_bom.html#30

This character should be preceded by a low surrogate (D800-DBFF). You
should combine the two into a single 4-byte UTF-8 character.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Kreen 2006-05-26 14:16:59 Re: Bug with UTF-8 character
Previous Message Gurjeet Singh 2006-05-26 13:45:54 Re: max(*)