use surrogateescape error handling to just copy non-ascii chars into the output