summaryrefslogtreecommitdiff
path: root/src/charset.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2008-06-28 11:03:50 +0000
committerBram Moolenaar <Bram@vim.org>2008-06-28 11:03:50 +0000
commitb983921b0cf2495af5192abc96d0066e09f02212 (patch)
treed55f53c774ba135a2f5c885d715606e5935ba69c /src/charset.c
parented0e7453617c558532aac0224e958f2bdad12a31 (diff)
downloadvim-git-b983921b0cf2495af5192abc96d0066e09f02212.tar.gz
updated for version 7.2a-006v7.2a.006
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/charset.c b/src/charset.c
index 282e8573e..0c9c51136 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -449,13 +449,15 @@ str_foldcase(str, orglen, buf, buflen)
{
if (enc_utf8)
{
- int c, lc;
-
- c = utf_ptr2char(STR_PTR(i));
- lc = utf_tolower(c);
- if (c != lc)
+ int c = utf_ptr2char(STR_PTR(i));
+ int ol = utf_ptr2len(STR_PTR(i));
+ int lc = utf_tolower(c);
+
+ /* Only replace the character when it is not an invalid
+ * sequence (ASCII character or more than one byte) and
+ * utf_tolower() doesn't return the original character. */
+ if ((c < 0x80 || ol > 1) && c != lc)
{
- int ol = utf_char2len(c);
int nl = utf_char2len(lc);
/* If the byte length changes need to shift the following