How to get a "screen" length of a multibyte string?

Serhiy Storchaka storchaka at gmail.com
Sun Nov 25 15:44:55 EST 2012


On 25.11.12 12:19, kobayashi wrote:
> Under platform that has fixed pitch font,
> I want to get a "screen" length of a multibyte string
>
> --- sample ---
> s1 = u"abcdef"
> s2 = u"あいう" # It has same "screen" length as s1's.
> print len(s1)  # Got 6
> print len(s2)  # Got 3, but I want get 6.
> --------------
>
> Abobe can get a "character" length of a multibyte string.
> Is there a way to get a "screen" length of a multibyte string?

http://bugs.python.org/issue12568




More information about the Python-list mailing list