bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] patch: Improve the rolling file name length for downloadi


From: Tim Ruehsen
Subject: Re: [Bug-wget] patch: Improve the rolling file name length for downloading progress image when without NLS
Date: Fri, 17 Feb 2017 12:20:15 +0100
User-agent: KMail/5.2.3 (Linux/4.9.0-1-amd64; KDE/5.28.0; x86_64; ; )

On Friday, February 17, 2017 12:05:21 PM CET Eli Zaretskii wrote:
> > From: Tim Ruehsen <address@hidden>
> > Date: Fri, 17 Feb 2017 09:48:23 +0100
> > Cc: "Andries E. Brouwer" <address@hidden>, YX Hao
> > <address@hidden> Calculating the number of displayed columns from
> > the number of bytes of a string is non-trivial. It is trivial only for
> > charsets/locales where each byte (or codepoint) will take exactly one
> > column on the display.
> > 
> > With unicode you have to *at least* compose the string first (NFC I
> > guess), and then count the codepoints. But I am not sure about
> > exceptions.
> > 
> > @Andries Do you know an algorithm how to calculate the columns from a
> > given
> > string + encoding ?
> 
> I'm not Andries, but AFAIK there's a file in the Unicode Character
> Database (UCD) called EastAsianWidth.txt which provides the width
> information.
> 
> There's also this (which is a derivative of the UCD data):
> 
>   https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c

Hi Eli,

thanks for pointing out.

I read bit in the gnulib source code... and wcwidth() should do it correctly 
(either gnulib or libc version).
This page made it clearer for me as well: http://stackoverflow.com/questions/
3634627/how-to-know-the-preferred-display-width-in-columns-of-unicode-
characters

Regards, Tim

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]