[Fix] PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding “UTF8”




I was trying to store Random IVs generated for AES encryption but couldn’t store them into a PostgreSQL database.


The Random IVs generated were binary data. So, you have to escape them.


While storing, do this


PGconn.escape_bytea(data)


While retrieving, do this


PGconn.unescape_bytea(data)


 







Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?