| 58 | } |
| 59 | |
| 60 | void p21encode(std::string_view input, std::ostringstream &output) |
| 61 | { |
| 62 | std::string tmp; |
| 63 | bool inEncode=false; |
| 64 | for (char c : input) { |
| 65 | if (c > 126 || c < 32) { |
| 66 | if (!inEncode) |
| 67 | { |
| 68 | inEncode = true; |
| 69 | tmp=c; |
| 70 | continue; |
| 71 | } else { |
| 72 | tmp+=c; |
| 73 | continue; |
| 74 | } |
| 75 | } else { |
| 76 | if (inEncode) { |
| 77 | encodeCharacters(output,tmp); |
| 78 | inEncode=false; |
| 79 | tmp.clear(); |
| 80 | } else if (c==39) { |
| 81 | output << c << c; |
| 82 | continue; |
| 83 | } |
| 84 | } |
| 85 | output << c; |
| 86 | } |
| 87 | if (inEncode) encodeCharacters(output,tmp); |
| 88 | } |
| 89 | |
| 90 | std::string utf8_from_utf16(const std::u16string& u16str) { |
| 91 | std::string utf8; |
no test coverage detected