osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Grapheme clusters, a.k.a.real characters


On 7/19/2017 4:28 AM, Steven D'Aprano wrote:
> On Tue, 18 Jul 2017 10:11:39 -0400, Random832 wrote:
> 
>> On Fri, Jul 14, 2017, at 04:15, Marko Rauhamaa wrote:
>>>   Consider, for example, a Python source code
>>> editor where you want to limit the length of the line based on the
>>> number of characters more typically than based on the number of pixels.
>>
>> Even there you need to go based on the width in character cells. Most
>> characters for East Asian languages occupy two character cells.
>>
>> It would be nice if there was an easy way to get str.format to use this
>> width instead of the length in code points for the purpose of padding.
> 
> You could always put in a feature request :-)

I believe that there is a request that at least one of the string 
functions be character width aware, using the unicodedatabase.


-- 
Terry Jan Reedy