| 198 | } |
| 199 | |
| 200 | static string utf8_validate(const char *s) |
| 201 | { |
| 202 | string d; |
| 203 | char32_t c; |
| 204 | int l; |
| 205 | |
| 206 | while ((l = utf8towc(&c, s))) |
| 207 | { |
| 208 | s += l; |
| 209 | |
| 210 | char buf[4]; |
| 211 | int r = wctoutf8(buf, c); |
| 212 | for (int i = 0; i < r; i++) |
| 213 | d.push_back(buf[i]); |
| 214 | } |
| 215 | return d; |
| 216 | } |
| 217 | |
| 218 | string mb_to_utf8(const char *s) |
| 219 | { |
no test coverage detected