[Top][All Lists]

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

Re: [Bug-wget] bad filenames (again)

From: Andries E. Brouwer
Subject: Re: [Bug-wget] bad filenames (again)
Date: Wed, 12 Aug 2015 19:36:52 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Aug 12, 2015 at 05:54:25PM +0200, Tim Ruehsen wrote:

> OK. Let's set up a test where we define input and expected output.
> If that works, I am fine.

OK. I mentioned a Hebrew example, but in order to avoid
the additional difficulty of bidi text, let me find a
Russian example instead.

% wget https://ru.wikipedia.org/wiki/%D0%A1%D0%B5%D1%80%D0%B4%D1%86%D0%B5
Saving to: ‘Се\321%80д\321%86е’

% my_wget https://ru.wikipedia.org/wiki/%D0%A1%D0%B5%D1%80%D0%B4%D1%86%D0%B5
Saving to: ‘Сердце’

(This is the Russian Wikipedia page for 'heart').



BTW - now that I tried this: the progress bar contains an ugly symbol.
Looking at progress.c I see

      int padding = MAX_FILENAME_COLS - orig_filename_cols;
      sprintf (p, "%s ", bp->f_download);
      p += orig_filename_cols + 1;
      for (;padding;padding--)
        *p++ = ' ';

but orig_filename_cols was computed correctly, counting character
positions, not bytes, and the
      p += orig_filename_cols + 1;
is a bug.
The ugly symbol is because a multibyte character was truncated.

If I write

      sprintf (p, "%s ", bp->f_download);
      p += strlen(bp->f_download) + 1;
      while (p < bp->buffer + MAX_FILENAME_COLS)
        *p++ = ' ';

instead, then the progress bar text looks right in this particular case.
I have not yet read the surrounding code.

reply via email to

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