diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-01-04 02:03:30 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-01-04 05:18:13 +0100 |
commit | 02281632ccbba3ef00a6968bfd697f4be836d0dd (patch) | |
tree | bac13076f812b968257140d9123f664905a5da8e /libtests | |
parent | b55567a0fa6708500cd0905f7a26a28d70979001 (diff) | |
download | qpdf-02281632ccbba3ef00a6968bfd697f4be836d0dd.tar.zst |
Add QUtil::utf8_to_ascii
Diffstat (limited to 'libtests')
-rw-r--r-- | libtests/qtest/qutil/qutil.out | 4 | ||||
-rw-r--r-- | libtests/qutil.cc | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libtests/qtest/qutil/qutil.out b/libtests/qtest/qutil/qutil.out index 8223bf5b..f47301e4 100644 --- a/libtests/qtest/qutil/qutil.out +++ b/libtests/qtest/qutil/qutil.out @@ -47,6 +47,10 @@ HAGOOGAMAGOOGLE: 0 0xdead -> ff fd 0x7fffffff -> ff fd 0x80000000 -> ff fd +---- utf8_to_ascii +Does π have fingers? +Does ? have fingers? +Does * have fingers? ---- whoami quack1 quack2 diff --git a/libtests/qutil.cc b/libtests/qutil.cc index 025f4e43..de51da58 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -220,6 +220,17 @@ void to_utf16_test() print_utf16(0x80000000UL); } +void utf8_to_ascii_test() +{ + char const* input = "Does \317\200 have fingers?"; + std::cout << input + << std::endl + << QUtil::utf8_to_ascii(input) + << std::endl + << QUtil::utf8_to_ascii(input, '*') + << std::endl; +} + void print_whoami(char const* str) { PointerHolder<char> dup(true, QUtil::copy_string(str)); @@ -328,6 +339,8 @@ int main(int argc, char* argv[]) to_utf8_test(); std::cout << "---- utf16" << std::endl; to_utf16_test(); + std::cout << "---- utf8_to_ascii" << std::endl; + utf8_to_ascii_test(); std::cout << "---- whoami" << std::endl; get_whoami_test(); std::cout << "---- file" << std::endl; |