| 12 | } |
| 13 | |
| 14 | static std::string hex_dump(const std::string& str) { |
| 15 | std::ostringstream oss; |
| 16 | for (unsigned char c : str) { |
| 17 | if (std::isprint(c)) { |
| 18 | oss << c; |
| 19 | } else { |
| 20 | oss << "\\x" << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(c); |
| 21 | } |
| 22 | } |
| 23 | return oss.str(); |
| 24 | } |
| 25 | |
| 26 | void test_unicode(testing &t) { |
| 27 | struct test_case { |