@@ -919,10 +919,11 @@ class StringNode(PyConstNode):
...
@@ -919,10 +919,11 @@ class StringNode(PyConstNode):
self.check_for_coercion_error(dst_type,fail=True)
self.check_for_coercion_error(dst_type,fail=True)
# this will be a unicode string in Py3, so make sure we can decode it
# this will be a unicode string in Py3, so make sure we can decode it
encoding=self.value.encodingor'UTF-8'
try:
try:
self.value.decode(self.value.encoding)
self.value.decode(encoding)
exceptUnicodeDecodeError:
exceptUnicodeDecodeError:
error(self.pos,"String decoding as '%s' failed. Consider using a byte string or unicode string explicitly, or adjust the source code encoding."%self.value.encoding)
error(self.pos,"String decoding as '%s' failed. Consider using a byte string or unicode string explicitly, or adjust the source code encoding."%encoding)