pgcli icon indicating copy to clipboard operation
pgcli copied to clipboard

There is a issue when I am trying to use Chinese

Open ahDDD opened this issue 10 years ago • 2 comments

I am write a piace of code, their UTF-8 encoding.

CREATE OR REPLACE FUNCTION log_event() RETURNS trigger AS $$
DECLARE
BEGIN
    INSERT INTO logs (event_id, old_title, old_starts, old_ends)
    VALUES (OLD.event_id, OLD.title, OLD.starts, OLD.ends);

    RAISE NOTICE '有人更改了event#%', OLD.event_id;

    RETURN NEW;
END;
$$ LANGUAGE plpgsql;

Which, I would like to use Chinese to write notice.

book> \i log_event.sql;
CREATE FUNCTION
Time: 0.035s

Everything seems be alright,but when I am trying to run it.

book> UPDATE events
..... set ends='2012-05-04 01:00:00'
..... WHERE title='House Party';
娉ㄦ剰:  鏈変汉鏇存敼浜唀vent#11

UPDATE 1
Time: 0.003s

It becomes such garbled texts. I was just trying to express someone just changed something. But when I run it in psql or pgAdmin. it changed back to normal. psql

book=# update events
book-# set ends='2012-05-04 01:00:00'
book-# where title='House Party';
注意:  有人更改了event#11
UPDATE 1

pgAdmin

UPDATE events
set ends='2012-05-04 01:00:00'
WHERE title='House Party';

message
注意:  有人更改了event#11
Query returned successfully: one row affected, 52 msec execution time.

So I was wondering if I did something wrong in the process. Pgcli is very good, of course, it may be myproblem, but I was just a question of learning postgresql. Looking forward to your answer.

ahDDD avatar May 13 '16 18:05 ahDDD

Hi @ahDDD,

Sorry about the failure. I have a potential fix in a branch. Can you please try it out and let me know if it works as expected?

You can install the fixed version as follows:

pip install -U https://github.com/dbcli/pgcli/archive/amjith/unicode-notices.zip

I appreciate you filing the bug.

amjith avatar May 14 '16 04:05 amjith

This is now available in v1.0. Please upgrade.

pip install -U pgcli

amjith avatar Jun 29 '16 03:06 amjith