wxString encoding problem in apache

Franky Braem f.braem at skynet.be
Mon Jan 29 14:14:55 PST 2007


I'm trying to use UNICODE in my Apache module. wxStrings are stored in 
UTF-16. When I write the content to Apache as UTF-8 everything works. 
When I use UTF-16 as content encoding I see the following as HTML:

< h t m l >

The code that generates the HTML is as follows:

wxString value;
FromJS(cx, argv[i], value); // JS keeps strings as UTF-16

wxCSConv conv(wxString::FromAscii(r->content_encoding));
int length = conv.WC2MB(NULL, value.c_str(), 0);
char *content = new char[length + conv.GetMBNulLen()];
length = conv.WC2MB(content, value, length + conv.GetMBNulLen());
int written = ap_rwrite(content, length, r);
ap_rflush(r);
delete[] content;

What am I doing wrong?


Franky.






More information about the wx-users mailing list