Mercurial > vim
changeset 6274:3005da486a71 v7.4.471
updated for version 7.4.471
Problem: MS-Windows: When printer name contains multi-byte, the name is
displayed as ???.
Solution: Convert the printer name from the active codepage to 'encoding'.
(Yasuhiro Matsumoto)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 09 Oct 2014 17:05:56 +0200 |
parents | 9d44b402fb1b |
children | 36d22bbf4c5c |
files | src/os_mswin.c src/version.c |
diffstat | 2 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -1635,11 +1635,33 @@ mch_print_init(prt_settings_T *psettings char_u *printer_name = (char_u *)devname + devname->wDeviceOffset; char_u *port_name = (char_u *)devname +devname->wOutputOffset; char_u *text = _("to %s on %s"); - +#ifdef FEAT_MBYTE + char_u *printer_name_orig = printer_name; + char_u *port_name_orig = port_name; + + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + char_u *to_free = NULL; + int maxlen; + + acp_to_enc(printer_name, STRLEN(printer_name), &to_free, &maxlen); + if (to_free != NULL) + printer_name = to_free; + acp_to_enc(port_name, STRLEN(port_name), &to_free, &maxlen); + if (to_free != NULL) + port_name = to_free; + } +#endif prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name) + STRLEN(text))); if (prt_name != NULL) wsprintf(prt_name, text, printer_name, port_name); +#ifdef FEAT_MBYTE + if (printer_name != printer_name_orig) + vim_free(printer_name); + if (port_name != port_name_orig) + vim_free(port_name); +#endif } GlobalUnlock(prt_dlg.hDevNames);