IOError messages are bytestrings, often in the language of the system, so they may include non-ASCII characters. Thus, we must decode them using the locale's preferred encoding to get Unicode objects we safely can pass on for logging the IOError.