Mercurial > vim
changeset 13925:eb264a775071 v8.0.1833
patch 8.0.1833: X11: ":echo 3.14" gives E806
commit https://github.com/vim/vim/commit/889fe2c2b9ba5c92b7e862a4aafbd863585fd633
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 13 16:23:40 2018 +0200
patch 8.0.1833: X11: ":echo 3.14" gives E806
Problem: X11: ":echo 3.14" gives E806.
Solution: set LC_NUMERIC to "C". (Dominique Pelle, closes https://github.com/vim/vim/issues/2368)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 13 May 2018 16:30:06 +0200 |
parents | 31e8a593e29d |
children | e104131e69e2 |
files | src/gui_x11.c src/version.c |
diffstat | 2 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -1282,6 +1282,17 @@ gui_mch_init_check(void) cmdline_options, XtNumber(cmdline_options), CARDINAL &gui_argc, gui_argv); +# if defined(FEAT_FLOAT) && defined(LC_NUMERIC) + { + /* The call to XtOpenDisplay() may have set the locale from the + * environment. Set LC_NUMERIC to "C" to make sure that strtod() uses a + * decimal point, not a comma. */ + char *p = setlocale(LC_NUMERIC, NULL); + + if (p == NULL || strcmp(p, "C") != 0) + setlocale(LC_NUMERIC, "C"); + } +# endif if (app_context == NULL || gui.dpy == NULL) { gui.dying = TRUE;