how to use charsets other than ISO-8859-1

Hi *,

 

I use libwww in my code that acts as an http client. The client does http
posts, receives and evaluates the web server responses. I would like to know
how to handle the response/return values that are UTF-16.

 

I use the following code, after initializing the http client with default
set of converters, transfer encoders and MIME header parsers.

 

request = HTRequest_new();

HTRequest_setOutputFormat(request, WWW_SOURCE);

anchor = HTAnchor_findAddress(uri);

    

chunk = HTPostFormAnchorToChunk(formfields, anchor, request);

String returnVal = HTChunk_data(chunk);

 

Since the response (chunk) from the web server is in "charset: UTF-16" (like
"D.o.n.e.", where . is hex 00, which is NULL), the characters are not
interpreted right and the string is terminated after first character.

 

Is there a way to get around this problem? I some how need to get the raw
data (before it is converted into char *) into a wchar_t and convert it into
a multibyte string.

 

If using HTCharset_add (HTList * list, const char * charset, double quality)
can help, how would the input arguments look like, say for UTF-16?

 

I would appreciate any help

Thanks a lot

Aravind

 

Received on Tuesday, 17 December 2002 11:00:29 UTC