diff Python/exceptions.c @ 30138:f746d5690ad6 legacy-trunk

Add a unicode prefix to the characters in the UnicodeEncodeError and UnicodeTranslateError message.
author Walter Dörwald <walter@livinglogic.de>
date Tue, 12 Aug 2003 17:34:49 +0000
parents df654861ccf6
children 0813b33610cc
line wrap: on
line diff
--- a/Python/exceptions.c	Tue Aug 12 17:32:43 2003 +0000
+++ b/Python/exceptions.c	Tue Aug 12 17:34:49 2003 +0000
@@ -1254,11 +1254,11 @@
 	int badchar = (int)PyUnicode_AS_UNICODE(objectObj)[start];
 	char *format;
 	if (badchar <= 0xff)
-	   format = "'%.400s' codec can't encode character '\\x%02x' in position %d: %.400s";
+	   format = "'%.400s' codec can't encode character u'\\x%02x' in position %d: %.400s";
 	else if (badchar <= 0xffff)
-	   format = "'%.400s' codec can't encode character '\\u%04x' in position %d: %.400s";
+	   format = "'%.400s' codec can't encode character u'\\u%04x' in position %d: %.400s";
 	else
-	   format = "'%.400s' codec can't encode character '\\U%08x' in position %d: %.400s";
+	   format = "'%.400s' codec can't encode character u'\\U%08x' in position %d: %.400s";
 	PyOS_snprintf(buffer, sizeof(buffer),
 	    format,
 	    PyString_AS_STRING(encodingObj),
@@ -1449,11 +1449,11 @@
 	int badchar = (int)PyUnicode_AS_UNICODE(objectObj)[start];
 	char *format;
 	if (badchar <= 0xff)
-	   format = "can't translate character '\\x%02x' in position %d: %.400s";
+	   format = "can't translate character u'\\x%02x' in position %d: %.400s";
 	else if (badchar <= 0xffff)
-	   format = "can't translate character '\\u%04x' in position %d: %.400s";
+	   format = "can't translate character u'\\u%04x' in position %d: %.400s";
 	else
-	   format = "can't translate character '\\U%08x' in position %d: %.400s";
+	   format = "can't translate character u'\\U%08x' in position %d: %.400s";
 	PyOS_snprintf(buffer, sizeof(buffer),
 	    format,
 	    badchar,