diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-12-31 21:51:10 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-12-31 21:51:10 +0000 |
commit | 8d0aab0e785d93eed93a0434c99eb11485f54bfc (patch) | |
tree | cc00044a9e1b45063222408c0bebf07db8432db6 /epan | |
parent | 4ec4c649689a7b7b6f0e1d81f8e9e6d387de4fd5 (diff) |
From Ronald Henderson: make "format_text()", on Windows, escape all
characters that aren't printable ASCII, as GTK+ for Windows thinks
strings are UTF-8 but the strings we give it wouldn't be UTF-8.
svn path=/trunk/; revision=6832
Diffstat (limited to 'epan')
-rw-r--r-- | epan/strutil.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/epan/strutil.c b/epan/strutil.c index a3aee2c41d..17f5834ceb 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -1,13 +1,12 @@ /* strutil.c * String utility routines * - * $Id: strutil.c,v 1.9 2002/08/28 20:40:45 jmayer Exp $ + * $Id: strutil.c,v 1.10 2002/12/31 21:51:10 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs * - * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -173,7 +172,20 @@ format_text(const guchar *string, int len) fmtbuf = g_realloc(fmtbuf, fmtbuf_len); } c = *string++; + +#ifdef _WIN32 + /* + * XXX - "isprint()" can return "true" for non-ASCII characters, but + * those don't work with GTK+ on Windows, as GTK+ on Windows assumes + * UTF-8 strings. Until we fix up Ethereal to properly handle + * non-ASCII characters in all output (both GUI displays and text + * printouts) on all platforms including Windows, we work around + * the problem by escaping all characters that aren't printable ASCII. + */ + if (c >= 0x20 && c <= 0x7f) { +#else if (isprint(c)) { +#endif fmtbuf[column] = c; column++; } else { |