aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/qutil.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-15 21:56:06 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-15 22:13:12 +0100
commita478cbb6dc0e630b919813ad0e7ae1a72510c69d (patch)
treed7106d522f0bf2691c16e76eead59f5707ab67c7 /libtests/qutil.cc
parentfbd3e56da787d18e7a8794580d0e95b7669d1bc4 (diff)
downloadqpdf-a478cbb6dc0e630b919813ad0e7ae1a72510c69d.tar.zst
Silently/transparently recognize UTF-16LE as UTF-16 (fixes #649)
The PDF spec only allows UTF-16BE, but most readers seem to accept UTF-16LE as well, so now qpdf does too.
Diffstat (limited to 'libtests/qutil.cc')
-rw-r--r--libtests/qutil.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/libtests/qutil.cc b/libtests/qutil.cc
index 2e4d9cdd..a1340c0e 100644
--- a/libtests/qutil.cc
+++ b/libtests/qutil.cc
@@ -303,6 +303,7 @@ void to_utf16_test()
std::string s(QUtil::utf8_to_utf16("\xcf\x80"));
std::cout << QUtil::utf16_to_utf8(s) << std::endl;
std::cout << QUtil::utf16_to_utf8(s + ".") << std::endl;
+ std::cout << "LE: " << QUtil::utf16_to_utf8("\xff\xfe\xc0\x03") << std::endl;
}
void utf8_to_ascii_test()
@@ -388,7 +389,8 @@ void transcoding_test()
check_analyze("pi = \317\200", true, true, false);
check_analyze("pi != \317", true, false, false);
check_analyze("pi != 22/7", false, false, false);
- check_analyze(std::string("\xfe\xff\00\x51", 4), true, false, true);
+ check_analyze(std::string("\xfe\xff\x00\x51", 4), true, false, true);
+ check_analyze(std::string("\xff\xfe\x51\x00", 4), true, false, true);
std::cout << "analysis done" << std::endl;
std::string input1("a\302\277b");
std::string input2("a\317\200b");