Skip to content

Commit

Permalink
Remove long-obsolete UTF-8 support for Unicode chars larger than U+10…
Browse files Browse the repository at this point in the history
…FFFF.
  • Loading branch information
gwsw committed Sep 24, 2023
1 parent ec906cb commit 02d17dd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,12 @@ public int utf_len(int ch)
return 3;
if ((ch & 0xF8) == 0xF0)
return 4;
#if 0
if ((ch & 0xFC) == 0xF8)
return 5;
if ((ch & 0xFE) == 0xFC)
return 6;
#endif
/* Invalid UTF-8 encoding. */
return 1;
}
Expand Down Expand Up @@ -688,6 +690,7 @@ public LWCHAR get_wchar(constant char *p)
((p[1] & 0x3F) << 12) |
((p[2] & 0x3F) << 6) |
(p[3] & 0x3F));
#if 0
case 5:
/* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
return (LWCHAR) (
Expand All @@ -705,6 +708,7 @@ public LWCHAR get_wchar(constant char *p)
((p[3] & 0x3F) << 12) |
((p[4] & 0x3F) << 6) |
(p[5] & 0x3F));
#endif
}
}

Expand Down Expand Up @@ -735,6 +739,7 @@ public void put_wchar(char **pp, LWCHAR ch)
*(*pp)++ = (char) (0x80 | ((ch >> 12) & 0x3F));
*(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F));
*(*pp)++ = (char) (0x80 | (ch & 0x3F));
#if 0
} else if (ch < 0x4000000)
{
/* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
Expand All @@ -752,6 +757,7 @@ public void put_wchar(char **pp, LWCHAR ch)
*(*pp)++ = (char) (0x80 | ((ch >> 12) & 0x3F));
*(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F));
*(*pp)++ = (char) (0x80 | (ch & 0x3F));
#endif
}
}

Expand Down

0 comments on commit 02d17dd

Please sign in to comment.