Skip to content

Fix 276 properly handle non utf8 characters

ng requested to merge fix-276-properly-handle-non-utf8-characters into master

There are multiple keys around with broken encoding for name, uid or comment for a UserID in a key. This mainly becomes a problem, when such a string should become part of JSON, as it will raise an Encoding::UndefinedConversionError. In other places it might have printed the following warning to STDERR.

"Non US-ASCII detected and no charset defined. Defaulting to UTF-8, set your own if this is incorrect."

This commits adds various tests that show the different places, where this can cause problems. Also it fixes it by monkeypatching GPGME::UserID, to properly encode its fields. This gives one central place to properly encode strings before printing them out.

This might be a patch suited for upstream, though enforcing such an encoding, might also be too invasive for a library, while a tool like Schleuder, should ensure proper encoding everywhere where it matters.

This mainly fixes a barfing API daemon, which makes it impossible to manage lists over schleuder-web or schleuder-cli anymore.

Merge request reports