aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-05-06 10:25:02 -0700
committerAnders Broman <a.broman58@gmail.com>2016-05-09 04:11:29 +0000
commitae4a912af04456a6fc4022150485be541f65d96c (patch)
tree2d98b9431e142cebb945aa4649872d83480d3c1c /wsutil
parent6bd2e29358d6d9dbd334b263aae6a5ae2c049db3 (diff)
TShark: Convert TTY output.
If we detect that we're writing to a TTY and that it doesn't support UTF-8, convert our output to the current code page on UNIX/Linux or to UTF-16LE on Windows. This helps to ensure that we don't fill users' screens with mojibake, along with scrubbing invalid output. Add a note about our output behavior to the TShark man page. Add a note about the glyphs we should and shouldn't be using to utf8_entities.h. Bug: 12393 Change-Id: I52b6dd240173b80ffb6d35b5950a46a565c97ce8 Reviewed-on: https://code.wireshark.org/review/15277 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/utf8_entities.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/wsutil/utf8_entities.h b/wsutil/utf8_entities.h
index dc5deba554..13dba64270 100644
--- a/wsutil/utf8_entities.h
+++ b/wsutil/utf8_entities.h
@@ -29,6 +29,12 @@
* http://www.fileformat.info/info/unicode/
* http://www.utf8-chartable.de/
* and other places
+ *
+ * While many modern systems default to UTF-8 and handle it well, some do
+ * not. The Windows console is a notable example. When adding a glyph below
+ * you probably shouldn't stray too far from code page 437 or WGL4:
+ * https://en.wikipedia.org/wiki/Code_page_437
+ * https://en.wikipedia.org/wiki/Windows_Glyph_List_4
*/
#define UTF8_DEGREE_SIGN "\xc2\xb0" /* 176 / 0xb0 */
@@ -43,6 +49,7 @@
#define UTF8_RIGHTWARDS_ARROW "\xe2\x86\x92" /* 8594 / 0x2192 */
#define UTF8_LEFT_RIGHT_ARROW "\xe2\x86\x94" /* 8596 / 0x2194 */
+/* OS X command key */
#define UTF8_PLACE_OF_INTEREST_SIGN "\xe2\x8c\x98" /* 8984 / 0x2318 */
#define UTF8_SYMBOL_FOR_NULL "\xe2\x90\x80" /* 9216 / 0x2400 */