[issue2382] [Py3k] SyntaxError cursor shifted if multibyte character is in line.

STINNER Victor report at bugs.python.org
Sun Mar 15 15:56:08 CET 2009


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

This issue is a problem of units. The error text is an utf8 *byte* 
string and offset is a number of *bytes*. The goal is to get the text 
*width* of a *character* string. We have to:
 1- convert offset from bytes number to character number
 2- get the error message as (unicode) characters
 3- get the width of text[:offset]

It's already possible to get (2) from the utf8 string, and code from 
ocean-city's patch (py3k_adjust_cursor_at_syntax_error_v2.patch) can 
be used for (3). The most difficult point is (1).

I will try to implement that.

----------

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


More information about the Python-bugs-list mailing list