agent: Use the locale module to get the preferred encoding

The guest agent used for the string sanitization sys.stdout.encoding
which is set to None when you're running without an allocated console.
This is the case on Windows as a service. The locale module provides
the function getpreferredencoding() which returns the required value.

Resolves: BZ#962667

Change-Id: I9ff6e3c7165599f80d13115e0173eefe0e79e664
Bug-Url: https://bugzilla.redhat.com/962667
Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>