From: John Darrington Date: Tue, 9 Apr 2013 20:32:04 +0000 (+0200) Subject: Ascii driver: Default to box=unicode iff the charset is UTF8 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fbuilds%2F20130411010506%2Fpspp;p=pspp Ascii driver: Default to box=unicode iff the charset is UTF8 --- diff --git a/doc/invoking.texi b/doc/invoking.texi index 24259a5808..039a2ad4aa 100644 --- a/doc/invoking.texi +++ b/doc/invoking.texi @@ -333,10 +333,13 @@ Length of the bottom margin, in lines. @pspp{} subtracts this value from the page length. Default: @code{0}. @item @option{-O box=@{ascii|unicode@}} -Sets the characters used for lines in tables. The default, -@code{ascii}, uses @samp{-}, @samp{|}, and @samp{+} for single-width -lines and @samp{=} and @samp{#} for double-width lines. Specify -@code{unicode} to use Unicode box drawing characters. +Sets the characters used for lines in tables. +If set to +@code{ascii} the characters @samp{-}, @samp{|}, and @samp{+} for single-width +lines and @samp{=} and @samp{#} for double-width lines are used. +If set to @code{unicode} then Unicode box drawing characters will be used. +The default is @code{unicode} if the locale's character encoding is "UTF-8" +or @code{ascii} otherwise. @item @option{-O emphasis=@{none|bold|underline@}} How to emphasize text. Bold and underline emphasis are achieved with diff --git a/src/ui/terminal/terminal-opts.c b/src/ui/terminal/terminal-opts.c index 121d89d571..95007a0cb4 100644 --- a/src/ui/terminal/terminal-opts.c +++ b/src/ui/terminal/terminal-opts.c @@ -20,6 +20,8 @@ #include #include +#include + #include "data/settings.h" #include "data/file-name.h" @@ -39,6 +41,7 @@ #include "output/msglog.h" #include "gl/error.h" +#include "gl/localcharset.h" #include "gl/progname.h" #include "gl/version-etc.h" #include "gl/xmemdup0.h" @@ -302,6 +305,8 @@ terminal_opts_init (struct argv_parser *ap, void terminal_opts_done (struct terminal_opts *to, int argc, char *argv[]) { + if (0 == strcmp (locale_charset (), "UTF-8")) + string_map_insert (&to->options, "box", "unicode"); register_output_driver (to); if (!to->has_output_driver) {