Hi YX Hao,

could you try the appended patch.

If this doesn't work out for you, we have to base our fixes on this patch, but
let's see first.

Regards, Tim
From c6c014377a14beb3e2a240f8be21665100d3c941 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim Rühsen?= <[email protected]>
Date: Fri, 17 Feb 2017 10:08:51 +0100
Subject: [PATCH] Always use multi-byte code for progress bar

* src/progress.c: Remove conditional code for USE_NLS_PROGRESS_BAR
* src/utils.c: Likewise
* src/wget.h: Remove definition of USE_NLS_PROGRESS_BAR

Reported-by: XY Hao
---
 src/progress.c | 14 --------------
 src/utils.c    |  7 +------
 src/wget.h     |  7 -------
 3 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/src/progress.c b/src/progress.c
index f44e0eef..6f5bebb0 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -789,7 +789,6 @@ update_speed_ring (struct bar_progress *bp, wgint howmuch, double dltime)
 #endif
 }

-#if USE_NLS_PROGRESS_BAR
 static int
 count_cols (const char *mbs)
 {
@@ -840,15 +839,6 @@ cols_to_bytes (const char *mbs, const int cols, int *ncols)
   *ncols = p_cols;
   return bytes;
 }
-#else
-static int count_cols (const char *mbs) { return (int) strlen(mbs); }
-static int
-cols_to_bytes (const char *mbs _GL_UNUSED, const int cols, int *ncols)
-{
-  *ncols = cols;
-  return cols;
-}
-#endif

 static const char *
 get_eta (int *bcd)
@@ -863,11 +853,7 @@ get_eta (int *bcd)
       int nbytes;
       int ncols;

-#if USE_NLS_PROGRESS_BAR
       eta_trans = _(eta_str);
-#else
-      eta_trans = eta_str;
-#endif

       /* Determine the number of bytes used in the translated string,
        * versus the number of columns used. This is to figure out how
diff --git a/src/utils.c b/src/utils.c
index db89ae1f..30fd52a4 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1449,12 +1449,7 @@ get_grouping_data (const char **sep, const char **grouping)
       struct lconv *lconv = localeconv ();
       cached_sep = lconv->thousands_sep;
       cached_grouping = lconv->grouping;
-#if ! USE_NLS_PROGRESS_BAR
-      /* We can't count column widths, so ensure that the separator
-       * is single-byte only (let check below determine what byte). */
-      if (strlen(cached_sep) > 1)
-        cached_sep = "";
-#endif
+
       if (!*cached_sep)
         {
           /* Many locales (such as "C" or "hr_HR") don't specify
diff --git a/src/wget.h b/src/wget.h
index ed572451..416348e8 100644
--- a/src/wget.h
+++ b/src/wget.h
@@ -75,13 +75,6 @@ as that of the covered work.  */
    variables.  -- explanation partly taken from GNU make.  */
 #define N_(string) string

-#if HAVE_WCWIDTH && HAVE_MBTOWC
-# define USE_NLS_PROGRESS_BAR 1
-#else
-/* Just to be a little paranoid about it. */
-# undef  USE_NLS_PROGRESS_BAR
-#endif
-
 /* I18N NOTE: You will notice that none of the DEBUGP messages are
    marked as translatable.  This is intentional, for a few reasons:

--
2.11.0

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

Reply via email to