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