-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hrvoje Niksic wrote:
> Micah Cowan <[EMAIL PROTECTED]> writes:
> 
>> Also: the fix to the locale/progress-bar issues resulted in the
>> added use of a couple wide-character/multibyte-related functions,
>> mbtowc and wcwidth.
> 
> So far Wget has avoided explicit use of wc/mb functions on the account
> of portability.  Fortunately in most cases we don't really care about
> character representation of strings we use, progress.c being a notable
> exception.  I suggest that we check for availability of multibyte
> functions and, where missing, disable NLS and define stubs such as:

<snip>

> Disabling NLS should automatically diasble the use of multibyte
> functions, as well as (probably) the other way around.  That should
> ensure that Wget remain usable on platforms where NLS or wide-char
> support or both are broken.  After all, for most users (even those who
> don't speak English) Wget remains a simple command-line network
> utility, and translations are not of utmost importance to that target
> audience.

Alright, so I've made some changes in this area:

  http://hg.addictivecode.org/wget/1.11/rev/af916028f255

Which was further refined, slightly, with:

  http://hg.addictivecode.org/wget/1.11/rev/853349a9a89a

Rather than disable NLS altogether if wcwidth or mbtowc are missing,
I've opted to disable NLS support only for the progress bar itself: the
"eta" goes untranslated, and the group separators for the number of
bytes downloaded is forced to a single byte (if it would be more, it's
forced to , or . depending on what the decimal point is).

For instance, with LANG=ru_RU.UTF-8, I get output like:

10% [==>                            ] 4 812 839    296K/s  ОВП 2m 4s

(The number above is being separated by the Unicode "EN SPACE"
character, which is one character, but three bytes in UTF-8.)

However, if wcwidth or mbtowc are unavailable, it should print out:

10% [==>                            ] 4.812.839    296K/s  eta 2m 4s

And the count_cols function used by progress.c's create_image, is
#defined equivalent to strlen().

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHql+n7M8hyUobTrERAsqJAJ9qSHlCWmycn7g+kqWbyClLaQnWQgCfdiGq
mQIJwUD8dSMx6QUEouDKcjk=
=eeQW
-----END PGP SIGNATURE-----

Reply via email to