pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.53k stars 656 forks source link

View data causes errors with DB encoding EUC_JIS_2004 (RM #3992) #2358

Closed dpage closed 2 years ago

dpage commented 5 years ago

Issue migrated from Redmine: https://redmine.postgresql.org/issues/3992 Originally created by Hiroshi Shirosaki at 2019-02-14 06:10:38 UTC.

If database encoding is EUC_JIS_2004, View data all rows causes the following errors.

UnicodeDecodeError: 'euc_jis_2004' codec can't decode byte 0xe5 in position 0: illegal multibyte sequence

pgAdmin version is 4.2.

Client encoding seems to be set as UNICODE. EUC_JIS_2004 should be used. This is a fix for the bug.

--- a/web/pgadmin/utils/driver/psycopg2/encoding.py
+++ b/web/pgadmin/utils/driver/psycopg2/encoding.py
@@ -33,7 +33,7 @@
     :return:
     [Postgres_encoding, Python_encoding] - Postgres and Python encoding
     """
-    return encode_dict.get(key, ['UNICODE', 'utf-8'])
+    return encode_dict.get(key, [key, 'utf-8'])

 def configureDriverEncodings(encodings):
dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/3992#note-1 Originally created by Akshay Joshi at 2019-02-14 06:20:35 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed EDB Sprint 34
dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/3992#note-2 Originally created by Khushboo Vashi at 2019-02-25 11:04:27 UTC.

Redmine ticket header update:

Name Old Value New Value
Status changed New In Progress
Assigned To changed Khushboo Vashi
dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/3992#note-3 Originally created by Khushboo Vashi at 2019-02-26 09:03:38 UTC.

Patch sent. https://www.postgresql.org/message-id/CAFOhELf87TZHPLVe_n3SJiSmukZQwXFxTYAyM5vo9n3pdsE5LA@mail.gmail.com

dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/3992#note-4 Originally created by Akshay Joshi at 2019-02-27 10:32:06 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed EDB Sprint 34 EDB Sprint 35
dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/3992#note-5 Originally created by Khushboo Vashi at 2019-03-01 13:51:55 UTC.

Applied in changeset commit:849e34c2f763a9d084bd21840df6dde60c0a1b06.

Redmine ticket header update:

Name Old Value New Value
Status changed In Progress In Testing
Done Ratio changed 0 90
dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/3992#note-6 Originally created by Hiroshi Shirosaki at 2019-03-02 08:18:57 UTC.

Khushboo Vashi wrote:

Applied in changeset commit:849e34c2f763a9d084bd21840df6dde60c0a1b06.

Thanks for the fix. Encoding SHIFT_JIS_2004, SJIS are not included?

dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/3992#note-7 Originally created by Khushboo Vashi at 2019-03-04 07:19:56 UTC.

Hiroshi Shirosaki wrote:

Khushboo Vashi wrote:

Applied in changeset commit:849e34c2f763a9d084bd21840df6dde60c0a1b06.

Thanks for the fix. Encoding SHIFT_JIS_2004, SJIS are not included?

PostgreSQL does not support SHIFT_JIS_2004 and SJIS as a server side encoding. You can set it as a client side encoding explicitely in the query tool if you require.

dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/3992#note-8 Originally created by Fahar Abbas at 2019-03-11 14:25:51 UTC.

This is resolved in latest build: https://redmine.postgresql.org/issues/3992

Redmine ticket header update:

Name Old Value New Value
Status changed In Testing Resolved
Done Ratio changed 90 100
dpage commented 2 years ago

Issue closed on Redmine.