Re: utf8 encoding problem with plperlu - Mailing list pgsql-general

From Daniel Verite
Subject Re: utf8 encoding problem with plperlu
Date
Msg-id 2fa13094-3d86-4db3-9332-b064bb66f9fa@mm
Whole thread Raw
In response to utf8 encoding problem with plperlu  (Ronald Peterson <ron@hub.yellowbank.com>)
Responses Re: utf8 encoding problem with plperlu  (Ronald Peterson <ron@hub.yellowbank.com>)
List pgsql-general
    Ronald Peterson wrote:

> # select * from doublezero();
> INFO:  double00
> CONTEXT:  PL/Perl function "doublezero"
> ERROR:  invalid byte sequence for encoding "UTF8": 0x00 at line 8, <DATA>
> line 558.
> CONTEXT:  PL/Perl function "doublezero"
>
> I don't understand this.  I need to pass $mspass to Active Directory, and it
> the encoding is exactly as it should be, which is to say, it works for
> strings that don't include two consecutive zeros.  Is this a bug?

When replacing the literal "double00" with "foobar" in your function,
the same error occurs for me:

    test=# select doublezero();
    INFO:  foobar
    CONTEXT:  PL/Perl function "doublezero"
    ERROR:  invalid byte sequence for encoding "UTF8": 0x00 at line 6.
    CONTEXT:  fonction PL/Perl « doublezero »

Anyway it's not clear what you expect. PG doesn't support UTF-16,
and even if it did, it wouldn't accept such strings when the current
encoding is UTF-8.
If Active Directory wants UTF-16LE, you have to do that conversion, but
don't pass the result back to postgres in this format.


Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org


pgsql-general by date:

Previous
From: "Charles Clavadetscher"
Date:
Subject: Re: [9.5] question about row level security
Next
From: Ronald Peterson
Date:
Subject: Re: utf8 encoding problem with plperlu