Only encode Unicode objects when printing them raw.
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 40ce759..1cc6def 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -2064,7 +2064,8 @@
 			return -1;
 		}
 #ifdef Py_USING_UNICODE
-                if (PyUnicode_Check(v) && enc != Py_None) {
+                if ((flags & Py_PRINT_RAW) && 
+		    PyUnicode_Check(v) && enc != Py_None) {
 			char *cenc = PyString_AS_STRING(enc);
 			value = PyUnicode_AsEncodedString(v, cenc, "strict");
 			if (value == NULL)