Karsten Hopp 6dab6f
To: vim-dev@vim.org
Karsten Hopp 6dab6f
Subject: Patch 7.2.033
Karsten Hopp 6dab6f
Fcc: outbox
Karsten Hopp 6dab6f
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 6dab6f
Mime-Version: 1.0
Karsten Hopp 6dab6f
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 6dab6f
Content-Transfer-Encoding: 8bit
Karsten Hopp 6dab6f
------------
Karsten Hopp 6dab6f
Karsten Hopp 6dab6f
Patch 7.2.033
Karsten Hopp 6dab6f
Problem:    When detecting a little endian BOM "ucs-2le" is used, but the text
Karsten Hopp 6dab6f
	    might be "utf-16le".
Karsten Hopp 6dab6f
Solution:   Default to "utf-16le", it also works for "ucs-2le". (Jia Yanwei)
Karsten Hopp 6dab6f
Files:	    src/fileio.c, src/testdir/test42.ok
Karsten Hopp 6dab6f
Karsten Hopp 6dab6f
Karsten Hopp 6dab6f
*** ../vim-7.2.032/src/fileio.c	Sun Nov  9 13:43:25 2008
Karsten Hopp 6dab6f
--- src/fileio.c	Mon Nov  3 21:21:47 2008
Karsten Hopp 6dab6f
***************
Karsten Hopp 6dab6f
*** 5550,5558 ****
Karsten Hopp 6dab6f
  	    name = "ucs-4le";	/* FF FE 00 00 */
Karsten Hopp 6dab6f
  	    len = 4;
Karsten Hopp 6dab6f
  	}
Karsten Hopp 6dab6f
! 	else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
Karsten Hopp 6dab6f
  	    name = "ucs-2le";	/* FF FE */
Karsten Hopp 6dab6f
! 	else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
Karsten Hopp 6dab6f
  	    name = "utf-16le";	/* FF FE */
Karsten Hopp 6dab6f
      }
Karsten Hopp 6dab6f
      else if (p[0] == 0xfe && p[1] == 0xff
Karsten Hopp 6dab6f
--- 5550,5559 ----
Karsten Hopp 6dab6f
  	    name = "ucs-4le";	/* FF FE 00 00 */
Karsten Hopp 6dab6f
  	    len = 4;
Karsten Hopp 6dab6f
  	}
Karsten Hopp 6dab6f
! 	else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
Karsten Hopp 6dab6f
  	    name = "ucs-2le";	/* FF FE */
Karsten Hopp 6dab6f
! 	else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
Karsten Hopp 6dab6f
! 	    /* utf-16le is preferred, it also works for ucs-2le text */
Karsten Hopp 6dab6f
  	    name = "utf-16le";	/* FF FE */
Karsten Hopp 6dab6f
      }
Karsten Hopp 6dab6f
      else if (p[0] == 0xfe && p[1] == 0xff
Karsten Hopp 6dab6f
*** ../vim-7.2.032/src/testdir/test42.ok	Sat Mar  1 13:49:21 2008
Karsten Hopp 6dab6f
--- src/testdir/test42.ok	Sat Nov  1 17:09:29 2008
Karsten Hopp 6dab6f
***************
Karsten Hopp 6dab6f
*** 20,26 ****
Karsten Hopp 6dab6f
  ucs-2
Karsten Hopp 6dab6f
  
Karsten Hopp 6dab6f
  
Karsten Hopp 6dab6f
!   fileencoding=ucs-2le
Karsten Hopp 6dab6f
    bomb
Karsten Hopp 6dab6f
  ucs-2le
Karsten Hopp 6dab6f
  
Karsten Hopp 6dab6f
--- 20,26 ----
Karsten Hopp 6dab6f
  ucs-2
Karsten Hopp 6dab6f
  
Karsten Hopp 6dab6f
  
Karsten Hopp 6dab6f
!   fileencoding=utf-16le
Karsten Hopp 6dab6f
    bomb
Karsten Hopp 6dab6f
  ucs-2le
Karsten Hopp 6dab6f
  
Karsten Hopp 6dab6f
*** ../vim-7.2.032/src/version.c	Sun Nov  9 17:21:10 2008
Karsten Hopp 6dab6f
--- src/version.c	Tue Nov 11 21:54:14 2008
Karsten Hopp 6dab6f
***************
Karsten Hopp 6dab6f
*** 678,679 ****
Karsten Hopp 6dab6f
--- 678,681 ----
Karsten Hopp 6dab6f
  {   /* Add new patch number below this line */
Karsten Hopp 6dab6f
+ /**/
Karsten Hopp 6dab6f
+     33,
Karsten Hopp 6dab6f
  /**/
Karsten Hopp 6dab6f
Karsten Hopp 6dab6f
-- 
Karsten Hopp 6dab6f
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 6dab6f
234. You started college as a chemistry major, and walk out four years
Karsten Hopp 6dab6f
     later as an Internet provider.
Karsten Hopp 6dab6f
Karsten Hopp 6dab6f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 6dab6f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 6dab6f
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 6dab6f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///