2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-09-22 01:59:10 +00:00

Remove special case for 0xad for 10.6.2.

This commit is contained in:
Jay Berkenbilt 2022-02-16 06:52:05 -05:00
parent 38d8362c09
commit 3e2109ab37
3 changed files with 8 additions and 9 deletions

View File

@ -2293,10 +2293,9 @@ transcode_utf8(std::string const& utf8_val, std::string& result,
} }
else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) else if ((codepoint == 0xad) && (encoding == e_pdfdoc))
{ {
// PDFDocEncoding omits 0x00ad (soft hyphen), but rather // PDFDocEncoding omits 0x00ad (soft hyphen).
// than treating it as undefined, map it to a regular okay = false;
// hyphen. result.append(1, unknown);
result.append(1, '-');
} }
else if ((codepoint > 160) && (codepoint < 256) && else if ((codepoint > 160) && (codepoint < 256) &&
((encoding == e_winansi) || (encoding == e_pdfdoc))) ((encoding == e_winansi) || (encoding == e_pdfdoc)))

View File

@ -90,7 +90,7 @@ alternatives
0: 717561636b 0: 717561636b
done alternatives done alternatives
w˘wˇwˆw˙w˝w˛w˚w˜w<EFBFBD>w<EFBFBD>w<EFBFBD>w w˘wˇwˆw˙w˝w˛w˚w˜w<EFBFBD>w<EFBFBD>w<EFBFBD>w
w?w?w?w?w?w?w?w?w?w?w-w w?w?w?w?w?w?w?w?w?w?w?w
done other characters done other characters
---- whoami ---- whoami
quack1 quack1

View File

@ -3335,14 +3335,14 @@ static void test_86(QPDF& pdf, char const* arg2)
std::string utf16_val("\xfe\xff\x00\x1f", 4); std::string utf16_val("\xfe\xff\x00\x1f", 4);
std::string result; std::string result;
assert(QUtil::utf8_to_ascii(utf8_val, result, '?')); assert(QUtil::utf8_to_ascii(utf8_val, result, '?'));
assert(result == "\x1f"); assert(result == utf8_val);
assert(! QUtil::utf8_to_pdf_doc(utf8_val, result, '?')); assert(! QUtil::utf8_to_pdf_doc(utf8_val, result, '?'));
assert(result == "?"); assert(result == "?");
assert(QUtil::utf8_to_utf16(utf8_val) == utf16_val); assert(QUtil::utf8_to_utf16(utf8_val) == utf16_val);
assert(QUtil::utf16_to_utf8(utf16_val) == utf8_val); assert(QUtil::utf16_to_utf8(utf16_val) == utf8_val);
auto h = QPDFObjectHandle::newUnicodeString("\x1f"); auto h = QPDFObjectHandle::newUnicodeString(utf8_val);
assert(h.getStringValue() == std::string("\xfe\xff\x00\x1f", 4)); assert(h.getStringValue() == utf16_val);
assert(h.getUTF8Value() == "\x1f"); assert(h.getUTF8Value() == utf8_val);
} }
void runtest(int n, char const* filename1, char const* arg2) void runtest(int n, char const* filename1, char const* arg2)