Just for fun, the attached patch provides a fix that makes pkgtool more lenient. After applying it, setting an UTF-8 charset doesn't trigger the issue.
Caveat: I didn't time it but it probably slows down pkgtool, as I call sed as many times as there are installed package, instead of only once. Optimizing for speed is left to the reader as an exercise
PS Small tip to track invalid UTF-8 characters:
Code:
iconv -f UTF-8 -t UTF-8 <file> 2>bad
If bad is not empty, <file> is bad.
I did that for /source/kde/slack-desc/* and only kio-mtp is guilty.