Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b78068d6
Commit
b78068d6
authored
Aug 10, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert characters from the locale's encoding on output.
Reject characters outside the locale's encoding on input.
parent
86a5b160
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
Tools/idle/OutputWindow.py
Tools/idle/OutputWindow.py
+9
-0
Tools/idle/PyShell.py
Tools/idle/PyShell.py
+6
-1
No files found.
Tools/idle/OutputWindow.py
View file @
b78068d6
...
...
@@ -2,6 +2,7 @@ from Tkinter import *
from
EditorWindow
import
EditorWindow
import
re
import
tkMessageBox
import
IOBinding
class
OutputWindow
(
EditorWindow
):
...
...
@@ -34,6 +35,14 @@ class OutputWindow(EditorWindow):
# Act as output file
def
write
(
self
,
s
,
tags
=
(),
mark
=
"insert"
):
# Tk assumes that byte strings are Latin-1;
# we assume that they are in the locale's encoding
if
isinstance
(
s
,
str
):
try
:
s
=
unicode
(
s
,
IOBinding
.
encoding
)
except
UnicodeError
:
# some other encoding; let Tcl deal with it
pass
self
.
text
.
insert
(
mark
,
s
,
tags
)
self
.
text
.
see
(
mark
)
self
.
text
.
update
()
...
...
Tools/idle/PyShell.py
View file @
b78068d6
...
...
@@ -191,7 +191,12 @@ class ModifiedInterpreter(InteractiveInterpreter):
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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment