You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/malemburg'closed_at=<Date2004-11-16.12:12:44.000>created_at=<Date2004-11-16.11:58:42.000>labels= ['expert-unicode']
title="Incorrect length of unicode strings using .encode('utf-8')"updated_at=<Date2004-11-16.12:12:44.000>user='https://bugs.python.org/edschofield'
print "x = %-15s" %(x.encode('utf-8'),) + " more text"
gives an incorrect number of spaces when x is a
two-byte unicode character like à. There is no such
problem if x is used alone rather than its encode(...)
method.
The reason seems to be this: if x = u'\u00e0' (the
character à) and s=x.encode('utf-8'), then len(s) = 2,
which breaks the print command above on a UTF-8 terminal.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: