Fix crash when stdin has no encoding.