diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-11-12 10:26:56 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-11-12 10:26:56 +0000 |
commit | a3f3ea6dbeac3a1b2f1148a67e6cf1975fc127ad (patch) | |
tree | a688eb7b928a091a149cbc4ff92c4d2a117a749e /epan/tvbuff.c | |
parent | 0284f4d4f55bd6c5e1706c6fa523b566a7634f1e (diff) | |
download | wireshark-a3f3ea6dbeac3a1b2f1148a67e6cf1975fc127ad.tar.gz |
From Charles Levert: in "tvb_fake_unicode()", convert non-ASCII
characters to '.'.
svn path=/trunk/; revision=12515
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r-- | epan/tvbuff.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c index eee139ff54..6446af9299 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -1624,9 +1624,9 @@ tvb_memeql(tvbuff_t *tvb, gint offset, const guint8 *str, gint size) } /* Convert a string from Unicode to ASCII. At the moment we fake it by - * assuming all characters are ASCII )-: The caller must free the - * result returned. The len parameter is the number of guint16's to - * convert from Unicode. */ + * replacing all non-ASCII characters with a '.' )-: The caller must + * free the result returned. The len parameter is the number of guint16's + * to convert from Unicode. */ char * tvb_fake_unicode(tvbuff_t *tvb, int offset, int len, gboolean little_endian) { @@ -1645,7 +1645,7 @@ tvb_fake_unicode(tvbuff_t *tvb, int offset, int len, gboolean little_endian) for (i = 0; i < len; i++) { character = little_endian ? tvb_get_letohs(tvb, offset) : tvb_get_ntohs(tvb, offset); - buffer[i] = character & 0xff; + buffer[i] = character < 256 ? character : '.'; offset += 2; } |