W3C home > Mailing lists > Public > www-lib@w3.org > October to December 2002

how to use charsets other than ISO-8859-1

From: Aravind Gadagottu <aravind.gadagottu@ixos.com>
Date: Fri, 13 Dec 2002 14:55:17 -0500 (EST)
Message-ID: <82ABF5DA09A4D411B83300D0B7847B0055D60E@hermes.sanmateo.ixos.com>
To: "'www-lib@w3.org'" <www-lib@w3.org>
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


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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:55 UTC