diff options
Diffstat (limited to '')
| -rw-r--r-- | source/html.c | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 6 insertions, 0 deletions
diff --git a/source/html.c b/source/html.c index 1a6b7c5..b6e62a6 100644 --- a/source/html.c +++ b/source/html.c @@ -247,6 +247,12 @@ ssize_t html_ntxt(const char *txt, size_t len) } p++; } + // A cut inside a multibyte character would leave an invalid sequence + // on the page, so it backs up to where that character starts. The + // escaped bytes are all ASCII, so no character spans one. + if (left < 0) + while (p > txt && (*p & 0xC0) == 0x80) + p--; if (p != txt) html_raw(txt, p - txt); return left; |
