| 101 | } |
| 102 | |
| 103 | static void rfc2047_test2(acl::rfc2047& rfc2047, const char* s) |
| 104 | { |
| 105 | acl::string out; |
| 106 | |
| 107 | printf("\n"); |
| 108 | printf("------------------ charset to utf-8 begin --------------\n"); |
| 109 | rfc2047.reset(true); |
| 110 | rfc2047.decode_update(s, (int) strlen(s)); |
| 111 | if (rfc2047.decode_finish("utf-8", &out)) |
| 112 | { |
| 113 | printf(">>> {%s}\n", out.c_str()); |
| 114 | rfc2047.debug_rfc2047(); |
| 115 | |
| 116 | acl::fstream fp; |
| 117 | if (fp.open_trunc("test.html")) |
| 118 | { |
| 119 | fp << "<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n" |
| 120 | << "<head>\r\n" |
| 121 | << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n" |
| 122 | << "</head>\r\n" |
| 123 | << "<body>\r\n"; |
| 124 | fp.write(out.c_str(), out.length()); |
| 125 | fp << "</body>\r\n</html>\r\n"; |
| 126 | } |
| 127 | } |
| 128 | else |
| 129 | printf(">>error: %s\n", out.c_str()); |
| 130 | printf("------------------ charset to utf-8 end ----------------\n"); |
| 131 | } |
| 132 | |
| 133 | static void rfc2047_test_encode(const char* s) |
| 134 | { |
no test coverage detected
searching dependent graphs…