Invalid byte sequence

I am migrating from sqLite to postgreSQL. Everything goes as expected, but when I try to add a password field to postgreSQL I get this error.

invalid byte sequence for encoding “UTF8”: 0xa6

The password field is encrypted like this:
hashValue = Crypto.PBKDF2(kSalt, value, 128, 32, Crypto.HashAlgorithms.SHA512),
based on the example from Xojo.

How can I solve this?
Thanks for an answer.

You’ve probably defined your passwordfield as text on Postgres and the server’s encoding as UTF-8. The server just duly tells you that it cannot store non-UTF8 data in a UTF8 text field. Consider using a bytea field for that purpose instead.

Thanks Maximilian, but I get the same error.

How exactly does your SQL look like? And how do you send it from Xojo? What PG version? Also I’d check the postgres log file to see if there is a more explicit error message.

I usually encodebase64 the hash before storing it in the database.

Thanks, that is the solution.