Karsten Hopp afd329
To: vim-dev@vim.org
Karsten Hopp afd329
Subject: Patch 7.1.261
Karsten Hopp afd329
Fcc: outbox
Karsten Hopp afd329
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp afd329
Mime-Version: 1.0
Karsten Hopp afd329
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp afd329
Content-Transfer-Encoding: 8bit
Karsten Hopp afd329
------------
Karsten Hopp afd329
Karsten Hopp afd329
Patch 7.1.261
Karsten Hopp afd329
Problem:    When a 2 byte BOM is detected Vim uses UCS-2, which doesn't work
Karsten Hopp afd329
	    for UTF-16 text. (Tony Mechelynck)
Karsten Hopp afd329
Solution:   Default to UTF-16.
Karsten Hopp afd329
Files:	    src/fileio.c, src/testdir/test42.ok
Karsten Hopp afd329
Karsten Hopp afd329
Karsten Hopp afd329
*** ../vim-7.1.260/src/fileio.c	Fri Jan  4 16:30:40 2008
Karsten Hopp afd329
--- src/fileio.c	Wed Feb 20 11:22:10 2008
Karsten Hopp afd329
***************
Karsten Hopp afd329
*** 5514,5523 ****
Karsten Hopp afd329
      else if (p[0] == 0xfe && p[1] == 0xff
Karsten Hopp afd329
  	    && (flags == FIO_ALL || flags == FIO_UCS2 || flags == FIO_UTF16))
Karsten Hopp afd329
      {
Karsten Hopp afd329
! 	if (flags == FIO_UTF16)
Karsten Hopp afd329
! 	    name = "utf-16";	/* FE FF */
Karsten Hopp afd329
! 	else
Karsten Hopp afd329
  	    name = "ucs-2";	/* FE FF */
Karsten Hopp afd329
      }
Karsten Hopp afd329
      else if (size >= 4 && p[0] == 0 && p[1] == 0 && p[2] == 0xfe
Karsten Hopp afd329
  	    && p[3] == 0xff && (flags == FIO_ALL || flags == FIO_UCS4))
Karsten Hopp afd329
--- 5523,5533 ----
Karsten Hopp afd329
      else if (p[0] == 0xfe && p[1] == 0xff
Karsten Hopp afd329
  	    && (flags == FIO_ALL || flags == FIO_UCS2 || flags == FIO_UTF16))
Karsten Hopp afd329
      {
Karsten Hopp afd329
! 	/* Default to utf-16, it works also for ucs-2 text. */
Karsten Hopp afd329
! 	if (flags == FIO_UCS2)
Karsten Hopp afd329
  	    name = "ucs-2";	/* FE FF */
Karsten Hopp afd329
+ 	else
Karsten Hopp afd329
+ 	    name = "utf-16";	/* FE FF */
Karsten Hopp afd329
      }
Karsten Hopp afd329
      else if (size >= 4 && p[0] == 0 && p[1] == 0 && p[2] == 0xfe
Karsten Hopp afd329
  	    && p[3] == 0xff && (flags == FIO_ALL || flags == FIO_UCS4))
Karsten Hopp afd329
*** ../vim-7.1.260/src/testdir/test42.ok	Sun Jun 13 21:02:32 2004
Karsten Hopp afd329
--- src/testdir/test42.ok	Wed Feb 20 13:27:37 2008
Karsten Hopp afd329
***************
Karsten Hopp afd329
*** 15,21 ****
Karsten Hopp afd329
  utf-8€err
Karsten Hopp afd329
  
Karsten Hopp afd329
  
Karsten Hopp afd329
!   fileencoding=ucs-2
Karsten Hopp afd329
    bomb
Karsten Hopp afd329
  ucs-2
Karsten Hopp afd329
  
Karsten Hopp afd329
--- 15,21 ----
Karsten Hopp afd329
  utf-8€err
Karsten Hopp afd329
  
Karsten Hopp afd329
  
Karsten Hopp afd329
!   fileencoding=utf-16
Karsten Hopp afd329
    bomb
Karsten Hopp afd329
  ucs-2
Karsten Hopp afd329
  
Karsten Hopp afd329
*** ../vim-7.1.260/src/version.c	Wed Feb 20 14:58:46 2008
Karsten Hopp afd329
--- src/version.c	Wed Feb 20 18:13:00 2008
Karsten Hopp afd329
***************
Karsten Hopp afd329
*** 668,669 ****
Karsten Hopp afd329
--- 668,671 ----
Karsten Hopp afd329
  {   /* Add new patch number below this line */
Karsten Hopp afd329
+ /**/
Karsten Hopp afd329
+     261,
Karsten Hopp afd329
  /**/
Karsten Hopp afd329
Karsten Hopp afd329
-- 
Karsten Hopp afd329
Seen it all, done it all, can't remember most of it.
Karsten Hopp afd329
Karsten Hopp afd329
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp afd329
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp afd329
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp afd329
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///