[issue20368] Tkinter: handle the null character

Serhiy Storchaka report at bugs.python.org
Thu Jan 23 16:15:02 CET 2014


New submission from Serhiy Storchaka:

Tcl/Tk uses modified UTF-8 encoding to represent strings as C strings (char*). Because C strings are NUL-terminated, the null character represented as illegal UTF-8 sequence \xc0\x80.

Current Tkinter code is not very aware about this. It has special handling the "\xc0\x80" string (i.e. encoded single null character) in one place, but doesn't handle encoded null character contained in larger string. As result Tkinter may truncate strings contained the null character, or return wrong result.

The proposed patch fixes many issues with the null character (converting from Tcl to Python strings). NUL is still forbidden in string arguments of many methods.

Also the patch enhances error handling for variable-related commands.

----------
components: Extension Modules, Tkinter
files: tkinter_null_character.patch
keywords: patch
messages: 208954
nosy: gpolo, kbk, loewis, roger.serwy, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: Tkinter: handle the null character
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33659/tkinter_null_character.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20368>
_______________________________________


More information about the Python-bugs-list mailing list