Ascii driver: Default to box=unicode iff the charset is UTF8 20130410010506/pspp 20130411010506/pspp 20130415100536/pspp 20130416010502/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 9 Apr 2013 20:32:04 +0000 (22:32 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 9 Apr 2013 20:32:04 +0000 (22:32 +0200)
doc/invoking.texi
src/ui/terminal/terminal-opts.c

index 24259a5808e2d0a101fbaf4acc58a1264319c334..039a2ad4aa032bc42ee6655676344e69ef24ce66 100644 (file)
@@ -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
index 121d89d5712a5bb127ff73f1778d5e498bb7a234..95007a0cb406a362d1521526634f66ba10e63719 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <stdbool.h>
 #include <stdlib.h>
+#include <string.h>
+
 
 #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)
     {