Re: utf8 encoding problem with plperlu

Поиск
Список
Период
Сортировка
От Ronald Peterson
Тема Re: utf8 encoding problem with plperlu
Дата
Msg-id CAJPRK8ZiJf1vVDZLb3QCNiN9nu3rciTK5nbTohNQ4qP9EVFP4A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: utf8 encoding problem with plperlu  ("Daniel Verite" <daniel@manitou-mail.org>)
Ответы Re: utf8 encoding problem with plperlu  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: utf8 encoding problem with plperlu  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
That's interesting.  What I'm really doing, instead of the second elog statement, is this:

$ret = $ldap->modify( $dn,
                      replace => {
                         unicodePwd => $mspass
                  } );

This does work for strings that don't contain consecutive zeroes.  I'm not really passing the string to PostgreSQL, but to Net::LDAP, but it must hit PostgreSQL anyway?  Active Directory requires this encoding, so I'm not sure what to do here.


On Wed, Jul 15, 2015 at 11:57 AM, Daniel Verite <daniel@manitou-mail.org> wrote:
        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



--
-R-




В списке pgsql-general по дате отправления:

Предыдущее
От: "Daniel Verite"
Дата:
Сообщение: Re: utf8 encoding problem with plperlu
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: utf8 encoding problem with plperlu