Fix libkml export on non-ASCII character set.

As reported in https://github.com/TauLabs/TauLabs/issues/816, the file export will fail for extended character sets. This forces the character set to be local, and returns an error if this is not possible.

This solves the problem for me on OSX in English, but it will need a Linux test as well.