pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Encoding issue updating database

Open phibian opened this issue 1 year ago • 4 comments

Looks like issue #3967 (RM #6018) is back in pgadmin 6.20 on Windows 11.

When using the data view to change enter an extended ascii character in a database encoded as SQL_ASCII the value is saved to the database as \x## instead of the expected character. Not sure exactly when this broke again but it was working for quite a while.

phibian avatar Mar 02 '23 19:03 phibian

@FaharAbbasRizvi

Can you please verify it with psycopg3?

akshay-joshi avatar Mar 03 '23 11:03 akshay-joshi

Hi @phibian

I am not able to reproduce the issue (https://github.com/pgadmin-org/pgadmin4/issues/3967) on the last release of pgadmin4 6.21 as well as on the last snapshot build?

How I tested: 1. Create SQL_ASSCI database: CREATE DATABASE SQLASSCI ENCODING 'SQL_ASCII ' TEMPLATE template0; 2. create table in SQLASSCI database:

CREATE TABLE public."ü" ( "ü" character(1000) COLLATE pg_catalog."default" NOT NULL, CONSTRAINT pk PRIMARY KEY ("ü") ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; 3. Insert values:

insert into public."ü" values('abc'); 4. Click on View data for a particular table 5. insert value and Click on Save data No issue is found.

Can you please retry it on the last release of pgadmin4?

FaharAbbasRizvi avatar Mar 13 '23 16:03 FaharAbbasRizvi

@phibian

Can you please share the steps to reproduce if you are still able to reproduce the issue?

FaharAbbasRizvi avatar Mar 13 '23 16:03 FaharAbbasRizvi

Just tried it again with .21 and it works fine within PGAdmin, but if you view the data from another program it shows the \x## code. It also appears to re-encode any existing extended ascii characters in the field as \x## codes as well. PGAdmin clearly knows how to interpret the data to display it but the raw data is being re-encoded. If I use psql.exe to view the data it changes. For example psql.exe outputs "é" (alt 130) as "Θ". After updating the field in PGAdmin psql.exe then outputs the same fields as "\xe9". psql.exe clearly doesn't know how to handle either encoding (which is fine) but PGAdmin is also clearly changing the encoding of extended ascii characters.

phibian avatar Mar 13 '23 18:03 phibian