| 74 | } |
| 75 | |
| 76 | static void rfc2047_test(acl::rfc2047& rfc2047, const char* s) |
| 77 | { |
| 78 | acl::string out; |
| 79 | |
| 80 | printf("\r\n\r\n"); |
| 81 | printf("------------------ src --------------------------------\r\n"); |
| 82 | printf("%s\r\n", s); |
| 83 | printf("------------------ charset to gb2312 begin ------------\r\n"); |
| 84 | rfc2047.reset(true); |
| 85 | rfc2047.decode_update(s, (int) strlen(s)); |
| 86 | if (rfc2047.decode_finish("gb18030", &out)) |
| 87 | { |
| 88 | printf(">>>before valid |%s|, len(%d)\r\n", out.c_str(), (int) out.size()); |
| 89 | |
| 90 | char buf[50]; |
| 91 | |
| 92 | get_valid_string(out.c_str(), (unsigned) out.length(), |
| 93 | buf, (unsigned) sizeof(buf) - 3); |
| 94 | printf(">>>after valid |%s|, len(%d)\n", buf, (int) strlen(buf)); |
| 95 | |
| 96 | rfc2047.debug_rfc2047(); |
| 97 | } |
| 98 | else |
| 99 | printf(">>error: %s\n", out.c_str()); |
| 100 | printf("------------------ charset to gb2312 end ---------------\n"); |
| 101 | } |
| 102 | |
| 103 | static void rfc2047_test2(acl::rfc2047& rfc2047, const char* s) |
| 104 | { |
no test coverage detected
searching dependent graphs…