JSON::GeneratorError ("\xA6" from ASCII-8BIT to UTF-8)

Ouuch, this one was not in the Release Notes.

JSON::GeneratorError ("\xA6" from ASCII-8BIT to UTF-8)
Caused by: Encoding::UndefinedConversionError ("\xA6" from ASCII-8BIT to UTF-8)

Information for: JSON::GeneratorError ("\xA6" from ASCII-8BIT to UTF-8):

app/tools/encryptor.rb:31:in `encrypt_and_sign'

Houston, we have a problem…

There seem to be some more severe change in encrypt_and_sign

Moving from 7.0.4 to 8.0.1, and I’m using this suggestion:

This suggest you are passing a string that isn’t encoded in UTF-8.

If it’s actually UTF-8, it probably mean it needs to be marked as such with str.force_encoding(Encoding::UTF_8).

laugh I am not supposed to know what encoding it is!

It is cipher material, and it should not be possible to figure out the language oder the encoding or any structural attribute of cipher material - ideally it appears as “white noise”, a random sequence of bits.

The most correct designation for the encoding would probably be ASCII-8BIT. But this fails - JSON apparently cannot do such, it is a genuine JSON limitation; it cannot handle raw ciphertext.

So after reading through the inline docs, I switched it to serializer: :message_pack - and that seems now to work again.