Handle file objects without encoding attribute set