073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.471
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.471
073263
Problem:    MS-Windows: When printer name contains multi-byte, the name is
073263
	    displayed as ???.
073263
Solution:   Convert the printer name from the active codepage to 'encoding'.
073263
	    (Yasuhiro Matsumoto)
073263
Files:	    src/os_mswin.c
073263
073263
073263
*** ../vim-7.4.470/src/os_mswin.c	2014-09-27 11:18:08.179520979 +0200
073263
--- src/os_mswin.c	2014-10-09 17:03:20.500915911 +0200
073263
***************
073263
*** 1635,1645 ****
073263
--- 1635,1667 ----
073263
  	char_u	*printer_name = (char_u *)devname + devname->wDeviceOffset;
073263
  	char_u	*port_name = (char_u *)devname +devname->wOutputOffset;
073263
  	char_u	*text = _("to %s on %s");
073263
+ #ifdef FEAT_MBYTE
073263
+ 	char_u  *printer_name_orig = printer_name;
073263
+ 	char_u	*port_name_orig = port_name;
073263
  
073263
+ 	if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
073263
+ 	{
073263
+ 	    char_u  *to_free = NULL;
073263
+ 	    int     maxlen;
073263
+ 
073263
+ 	    acp_to_enc(printer_name, STRLEN(printer_name), &to_free, &maxlen);
073263
+ 	    if (to_free != NULL)
073263
+ 		printer_name = to_free;
073263
+ 	    acp_to_enc(port_name, STRLEN(port_name), &to_free, &maxlen);
073263
+ 	    if (to_free != NULL)
073263
+ 		port_name = to_free;
073263
+ 	}
073263
+ #endif
073263
  	prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name)
073263
  							     + STRLEN(text)));
073263
  	if (prt_name != NULL)
073263
  	    wsprintf(prt_name, text, printer_name, port_name);
073263
+ #ifdef FEAT_MBYTE
073263
+ 	if (printer_name != printer_name_orig)
073263
+ 	    vim_free(printer_name);
073263
+ 	if (port_name != port_name_orig)
073263
+ 	    vim_free(port_name);
073263
+ #endif
073263
      }
073263
      GlobalUnlock(prt_dlg.hDevNames);
073263
  
073263
*** ../vim-7.4.470/src/version.c	2014-10-09 15:37:02.492904600 +0200
073263
--- src/version.c	2014-10-09 17:00:58.632915601 +0200
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     471,
073263
  /**/
073263
073263
-- 
073263
"Marriage is the process of finding out what kind of man your wife
073263
would have preferred"
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///