EnsureUTF8 (out);
}
+ length = strlen(out);
/* Convert control codes */
for (char *p = strchr (out, '\xC2'); p; p = strchr (p + 1, '\xC2'))
{
* 0x8B-0x9F are unspecified. */
if (p[1] == '\x8A')
memcpy (p, "\r\n", 2);
+
+ /* Strip character emphasis */
+ if (p[1] == '\x86' || p[1] == '\x87') {
+ const size_t n = p - out;
+ memmove (p, p+2, length - n);
+ length -= 2;
+ out[length] = '\0';
+ if (length == n)
+ break;
+ }
}
/* Private use area */
continue;
if (p[2] == '\x8A')
memcpy (p, "\r\r\n", 3); /* we need three bytes, so to CRs ;) */
+
+ /* Strip character emphasis */
+ if (p[2] == '\x86' || p[2] == '\x87') {
+ const size_t n = p - out;
+ memmove (p, p+3, length - n);
+ length -= 3;
+ out[length] = '\0';
+ if (length == n)
+ break;
+ }
}
return out;