vscode-postgres icon indicating copy to clipboard operation
vscode-postgres copied to clipboard

Columns of type bytea are displayed as text

Open jonasbb opened this issue 5 years ago • 3 comments

Screenshot from 2021-03-16 16-06-14 This occurs with version 1.1.17 of the extension. Columns of type bytea are displayed as text (see screenshot). This makes it impossible to read the value as most characters are simply the Unicode replacement character.

I would expect that either all or only non-ASCII characters are displayed encoded.

jonasbb avatar Mar 16 '21 15:03 jonasbb

Giving this issue a bump since this is still happening: Screenshot 2021-09-07 at 10 50 11

antonio-mendes avatar Sep 07 '21 09:09 antonio-mendes

So...

So that is coming from the fact that unicode is multi-byte character data. Probably something that could be worked out.

However, bytea presents a different problem, since it is just storing binary data - which can't really always be shown properly (images, zip files, etc...).

Currently it's just running through a .toString() and then an html entities function - which may be able to be optimized for this particular scenario - but still handling of bytea columns may change, to allow any large data stored that may be stored there to not break the ui.

Borvik avatar Sep 07 '21 11:09 Borvik

The most common way I've seen this handled is to format the bytes as a hex string, e.g., \x627dbbee83c04700018690cf that gives it readability and compatibility with many command line tools. Pinging here as this is a huge need for me.

jburgessjc avatar Jul 12 '22 21:07 jburgessjc