Is it necessary to convert the encoding to a string here? I assume File.open transforms it back to an object again.