Convert characters from the locale's encoding on output.

Reject characters outside the locale's encoding on input.
This commit is contained in:
Martin v. Löwis 2002-08-10 12:22:12 +00:00
parent 3ddb856ed1
commit 75ea1e11dc
2 changed files with 15 additions and 1 deletions

View file

@ -191,7 +191,12 @@ def runsource(self, source):
warnings.filterwarnings(action="error", category=SyntaxWarning)
if isinstance(source, types.UnicodeType):
import IOBinding
source = source.encode(IOBinding.encoding)
try:
source = source.encode(IOBinding.encoding)
except UnicodeError:
self.tkconsole.resetoutput()
self.write("Unsupported characters in input")
return
try:
return InteractiveInterpreter.runsource(self, source, filename)
finally: