Commit 3e2109ab373d8830146efbcb0af735ff58f9ad32

Authored by Jay Berkenbilt
1 parent 38d8362c

Remove special case for 0xad for 10.6.2.

libqpdf/QUtil.cc
... ... @@ -2293,10 +2293,9 @@ transcode_utf8(std::string const& utf8_val, std::string& result,
2293 2293 }
2294 2294 else if ((codepoint == 0xad) && (encoding == e_pdfdoc))
2295 2295 {
2296   - // PDFDocEncoding omits 0x00ad (soft hyphen), but rather
2297   - // than treating it as undefined, map it to a regular
2298   - // hyphen.
2299   - result.append(1, '-');
  2296 + // PDFDocEncoding omits 0x00ad (soft hyphen).
  2297 + okay = false;
  2298 + result.append(1, unknown);
2300 2299 }
2301 2300 else if ((codepoint > 160) && (codepoint < 256) &&
2302 2301 ((encoding == e_winansi) || (encoding == e_pdfdoc)))
... ...
libtests/qtest/qutil/qutil.out
... ... @@ -90,7 +90,7 @@ alternatives
90 90 0: 717561636b
91 91 done alternatives
92 92 w˘wˇwˆw˙w˝w˛w˚w˜w�w�w�w
93   -w?w?w?w?w?w?w?w?w?w?w-w
  93 +w?w?w?w?w?w?w?w?w?w?w?w
94 94 done other characters
95 95 ---- whoami
96 96 quack1
... ...
qpdf/test_driver.cc
... ... @@ -3335,14 +3335,14 @@ static void test_86(QPDF&amp; pdf, char const* arg2)
3335 3335 std::string utf16_val("\xfe\xff\x00\x1f", 4);
3336 3336 std::string result;
3337 3337 assert(QUtil::utf8_to_ascii(utf8_val, result, '?'));
3338   - assert(result == "\x1f");
  3338 + assert(result == utf8_val);
3339 3339 assert(! QUtil::utf8_to_pdf_doc(utf8_val, result, '?'));
3340 3340 assert(result == "?");
3341 3341 assert(QUtil::utf8_to_utf16(utf8_val) == utf16_val);
3342 3342 assert(QUtil::utf16_to_utf8(utf16_val) == utf8_val);
3343   - auto h = QPDFObjectHandle::newUnicodeString("\x1f");
3344   - assert(h.getStringValue() == std::string("\xfe\xff\x00\x1f", 4));
3345   - assert(h.getUTF8Value() == "\x1f");
  3343 + auto h = QPDFObjectHandle::newUnicodeString(utf8_val);
  3344 + assert(h.getStringValue() == utf16_val);
  3345 + assert(h.getUTF8Value() == utf8_val);
3346 3346 }
3347 3347  
3348 3348 void runtest(int n, char const* filename1, char const* arg2)
... ...