plainbox:exporter:xml: add and use _as_text_if_possible()

This patch is a response to export errors on some sessions that had
attachments with mostly text but some nul characters here and there.

Analysis revealed that two issues were at play:
 - handling textual attachments didn't use the _as_text() method
   which strips control characters that are forbidden by XML
 - _as_text() used .decode("UTF-8", "replace") which would effectively
   turn anything (any binary blob) into "text". In effect _as_text() was
   not given any way of failing to say "this aint text"

The solution is composed of three bound modifications:
 - the _as_text() method no longer uses .decode(encoding, "replace") so
   it can now fail as a part of normal operation.
 - since _as_text() could fail it now got replaced by
   _as_text_if_possible() that automatically falls back to binary mode
 - the _add_context() method that previously did some hand-coded text
   handling have used _as_text(). It now uses _as_text_if_possible()

Fixes: https://bugs.launchpad.net/plainbox/+bug/1398647

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
"automatic merge of lp:~zkrynicki/checkbox/fix-1398647/ by tarmac [r=sylvain-pineau][bug=1398647][author=zkrynicki]"