comparison src/main.c @ 12547:aa3f6d093f4b v8.0.1152

patch 8.0.1152: encoding of error message wrong in Cygwin terminal commit https://github.com/vim/vim/commit/2a02745709127bd56ccdbac8c568b3c25f3072a7 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 26 19:10:37 2017 +0200 patch 8.0.1152: encoding of error message wrong in Cygwin terminal Problem: Encoding of error message wrong in Cygwin terminal. Solution: Get locale from environment variables. (Ken Takata)
author Christian Brabandt <cb@256bit.org>
date Tue, 26 Sep 2017 19:15:05 +0200
parents 68d7bc045dbe
children a75fea44fb77
comparison
equal deleted inserted replaced
12546:088dd3306316 12547:aa3f6d093f4b
2562 } 2562 }
2563 #endif 2563 #endif
2564 #if defined(WIN3264) && !defined(FEAT_GUI_W32) 2564 #if defined(WIN3264) && !defined(FEAT_GUI_W32)
2565 if (is_cygpty_used()) 2565 if (is_cygpty_used())
2566 { 2566 {
2567 # if defined(FEAT_MBYTE) && defined(HAVE_BIND_TEXTDOMAIN_CODESET) \
2568 && defined(FEAT_GETTEXT)
2569 char *s, *tofree = NULL;
2570
2571 /* Set the encoding of the error message based on $LC_ALL or
2572 * other environment variables instead of 'encoding'.
2573 * Note that the message is shown on a Cygwin terminal (e.g.
2574 * mintty) which encoding is based on $LC_ALL or etc., not the
2575 * current codepage used by normal Win32 console programs. */
2576 tofree = s = enc_locale_env(NULL);
2577 if (s == NULL)
2578 s = "utf-8"; /* Use "utf-8" by default. */
2579 (void)bind_textdomain_codeset(VIMPACKAGE, s);
2580 vim_free(tofree);
2581 # endif
2567 mch_errmsg(_("Vim: Error: This version of Vim does not run in a Cygwin terminal\n")); 2582 mch_errmsg(_("Vim: Error: This version of Vim does not run in a Cygwin terminal\n"));
2568 exit(1); 2583 exit(1);
2569 } 2584 }
2570 #endif 2585 #endif
2571 if (!stdout_isatty) 2586 if (!stdout_isatty)