Re: Patch: add conversion from pg_wchar to multibyte

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tatsuo Ishii <ishii(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: add conversion from pg_wchar to multibyte
Date: 2012-07-01 09:11:38
Message-ID: CAPpHfduPZMmpq9yjmd8aXQsdMiG6tCU0w0VoBugz3EwR9o4yUw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 27, 2012 at 11:35 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> It looks to me like pg_wchar2utf_with_len will not work, because
> unicode_to_utf8 returns its second argument unmodified - not, as your
> code seems to assume, the byte following what was already written.
>

Fixed.

> MULE also looks problematic. The code that you've written isn't
> symmetric with the opposite conversion, unlike what you did in all
> other cases, and I don't understand why. I'm also somewhat baffled by
> the reverse conversion: it treats a multi-byte sequence beginning with
> a byte for which IS_LCPRV1(x) returns true as invalid if there are
> less than 3 bytes available, but it only reads two; similarly, for
> IS_LCPRV2(x), it demands 4 bytes but converts only 3.

Should we save existing pg_wchar representation for MULE encoding?
Probably, we can modify it like in 0.1 version of patch in order to make it
more transparent.

------
With best regards,
Alexander Korotkov.

Attachment Content-Type Size
wchar2mb-0.4.patch application/octet-stream 17.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Boszormenyi Zoltan 2012-07-01 11:02:17 [PATCH] Make pg_basebackup configure and start standby
Previous Message Amit kapila 2012-07-01 06:27:42 Re: patch-3 (3-allow-wal-record-header-to-be-split.patch)WAL Format Changes