summaryrefslogtreecommitdiffstats
path: root/RichString.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2022-12-26 18:00:28 +0100
committerBenBE <BenBE@geshi.org>2022-12-26 20:11:07 +0100
commit29f0b3c5e1184421ee7796ab2e1841733c45f403 (patch)
treefa593507d62cfd2f172d6c7f2f835bb40da51fef /RichString.c
parente9f3d96c9ae2c72a4cbd85c4ffb316ed2e0c3924 (diff)
Use Unicode replacement character
In unicode mode replace non-printable characters with the Unciode replacement character U+FFFD ("�").
Diffstat (limited to 'RichString.c')
-rw-r--r--RichString.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/RichString.c b/RichString.c
index 3dac0832..daa0c91f 100644
--- a/RichString.c
+++ b/RichString.c
@@ -61,7 +61,7 @@ static inline int RichString_writeFromWide(RichString* this, int attrs, const ch
int newLen = from + len;
RichString_setLen(this, newLen);
for (int i = from, j = 0; i < newLen; i++, j++) {
- this->chptr[i] = (CharType) { .attr = attrs & 0xffffff, .chars = { (iswprint(data[j]) ? data[j] : '?') } };
+ this->chptr[i] = (CharType) { .attr = attrs & 0xffffff, .chars = { (iswprint(data[j]) ? data[j] : L'\xFFFD') } };
}
return len;
@@ -79,7 +79,7 @@ int RichString_appendnWideColumns(RichString* this, int attrs, const char* data_
int columnsWritten = 0;
int pos = from;
for (int j = 0; j < len; j++) {
- wchar_t c = iswprint(data[j]) ? data[j] : '?';
+ wchar_t c = iswprint(data[j]) ? data[j] : L'\xFFFD';
int cwidth = wcwidth(c);
if (cwidth > *columns)
break;
@@ -101,7 +101,7 @@ static inline int RichString_writeFromAscii(RichString* this, int attrs, const c
int newLen = from + len;
RichString_setLen(this, newLen);
for (int i = from, j = 0; i < newLen; i++, j++) {
- this->chptr[i] = (CharType) { .attr = attrs & 0xffffff, .chars = { (isprint(data[j]) ? data[j] : '?') } };
+ this->chptr[i] = (CharType) { .attr = attrs & 0xffffff, .chars = { (isprint(data[j]) ? data[j] : L'\xFFFD') } };
}
return len;

© 2014-2024 Faster IT GmbH | imprint | privacy policy