Re: postgres.app OS X psql character encoding (utf-8) problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: postgres.app OS X psql character encoding (utf-8) problem
Дата
Msg-id 17842.1389301751@sss.pgh.pa.us
обсуждение исходный текст
Ответ на postgres.app OS X psql character encoding (utf-8) problem  (Chris Hiestand <chiestand@salk.edu>)
Ответы Re: postgres.app OS X psql character encoding (utf-8) problem
Список pgsql-general
Chris Hiestand <chiestand@salk.edu> writes:
> If I enter a unicode character in the psql cli, such as:
> user=# select '�';

> But before hitting enter, use the keyboard "left" button to move the cursor across all the way to the left edge, and
thenback all the way to the right, the output get distorted and looks like this: 
> user=#select '�';;

What this sounds like is that the readline or libedit library doesn't
understand multibyte characters properly.  psql itself doesn't have
anything to do with the display of un-entered lines, but relies on
one of those libraries to manage input editing.

The default situation on OS X is generally that psql gets linked against
the Apple-supplied libedit, which goes so far as to masquerade as
readline.  Check "otool -L /path/to/psql"; if you see a reference to
/usr/lib/libedit.3.dylib, or to /usr/lib/libreadline.dylib
(which is really just a symlink to the former), then that's what you've
got.  While I'm generally a fan and user of Apple stuff, their version
of libedit is just abysmal; we've seen random crashes, complete failure
of tab completion, and other bugs in successive OS X releases.  I also
find specific references to multibyte input being busted in other
distros' versions of libedit, eg
http://www.postgresql.org/message-id/4D5B2C5A.8090506@catalyst.net.nz
so it may not be all Apple's fault; but they definitely have a track
record of shipping broken versions of libedit.

I'd strongly recommend installing the GNU readline library and rebuilding
psql against that.

            regards, tom lane


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

Предыдущее
От: Chris Hiestand
Дата:
Сообщение: postgres.app OS X psql character encoding (utf-8) problem
Следующее
От: David Johnston
Дата:
Сообщение: Re: Add custom properties to a column's definition (pg_attribute)