home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.1.183
- 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 6.1.183
- Problem: When 'fencs' is empty and 'enc' is utf-8, reading a file with
- illegal bytes gives "CONVERSION ERROR" even though no conversion
- is done. 'readonly' is set, even though writing the file results
- in an unmodified file.
- Solution: For this specific error use "ILLEGAL BYTE" and don't set
- 'readonly'.
- Files: src/fileio.c
-
-
- *** ../vim61.182/src/fileio.c Sun Aug 4 22:13:27 2002
- --- src/fileio.c Mon Sep 16 21:44:14 2002
- ***************
- *** 250,255 ****
- --- 250,256 ----
- #ifdef FEAT_MBYTE
- int can_retry;
- int conv_error = FALSE; /* conversion error detected */
- + int illegal_byte = FALSE; /* illegal byte detected */
- char_u *tmpname = NULL; /* name of 'charconvert' output file */
- int fio_flags = 0;
- char_u *fenc; /* fileencoding to use */
- ***************
- *** 1401,1407 ****
- }
- else if (enc_utf8 && !conv_error && !curbuf->b_p_bin)
- {
- ! /* Converting to UTF-8: Check if the bytes are valid UTF-8.
- * Need to start before "ptr" when part of the character was
- * read in the previous read() call. */
- for (p = ptr - utf_head_off(buffer, ptr); p < ptr + size; ++p)
- --- 1403,1409 ----
- }
- else if (enc_utf8 && !conv_error && !curbuf->b_p_bin)
- {
- ! /* Reading UTF-8: Check if the bytes are valid UTF-8.
- * Need to start before "ptr" when part of the character was
- * read in the previous read() call. */
- for (p = ptr - utf_head_off(buffer, ptr); p < ptr + size; ++p)
- ***************
- *** 1410,1416 ****
- {
- len = utf_ptr2len_check(p);
- /* A length of 1 means it's an illegal byte. Accept
- ! * an incomplete charater at the end though, the next
- * read() will get the next bytes, we'll check it
- * then. */
- if (len == 1)
- --- 1412,1418 ----
- {
- len = utf_ptr2len_check(p);
- /* A length of 1 means it's an illegal byte. Accept
- ! * an incomplete character at the end though, the next
- * read() will get the next bytes, we'll check it
- * then. */
- if (len == 1)
- ***************
- *** 1441,1447 ****
- }
-
- /* There is no alternative fenc, just report the error. */
- ! conv_error = TRUE;
- }
- }
- #endif
- --- 1443,1454 ----
- }
-
- /* There is no alternative fenc, just report the error. */
- ! # ifdef USE_ICONV
- ! if (iconv_fd != (iconv_t)-1)
- ! conv_error = TRUE;
- ! else
- ! # endif
- ! illegal_byte = TRUE;
- }
- }
- #endif
- ***************
- *** 1821,1826 ****
- --- 1828,1838 ----
- if (conv_error)
- {
- STRCAT(IObuff, _("[CONVERSION ERROR]"));
- + c = TRUE;
- + }
- + else if (illegal_byte)
- + {
- + STRCAT(IObuff, _("[ILLEGAL BYTE]"));
- c = TRUE;
- }
- else
- *** ../vim61.182/src/version.c Mon Sep 16 21:26:10 2002
- --- src/version.c Mon Sep 16 21:52:36 2002
- ***************
- *** 608,609 ****
- --- 608,611 ----
- { /* Add new patch number below this line */
- + /**/
- + 183,
- /**/
-
- --
- "You're fired." (1980)
- "You're laid off." (1985)
- "You're downsized." (1990)
- "You're rightsized." (1992)
- (Scott Adams - The Dilbert principle)
-
- /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\
- /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
- \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
- \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
-