Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2005 Jul : Detecting response encoding

www.cryer.info
Managed Newsgroup Archive

Detecting response encoding

Subject:Detecting response encoding
Posted by:"Kim Gräsman" (k..@mvps.org)
Date:Sun, 17 Jul 2005 08:55:54

Hello,

I thought I'd use WinInet to download web page content.
I want to convert the response to Unicode (in the Win32 sense, that's UCS-2
or UTF-16, right?) so I can pass it around as a BSTR.

I need to inspect the Content-Type header to figure out the charset of the
body, don't I?
Assuming that's valid, I should be able to map iso-8859-x -> CP_ACP and UTF-8
-> CP_UTF8, and just use MultiByteToWideChar to convert the body to UCS-2.

But I suppose the charset may be just about anything described by ISO --
is there a clean translation into Windows codepages from ISO charset names?
Or does WinInet solve this transparently?

--
Best Regards,
Kim Gräsman

Replies:

www.cryer.info
Managed Newsgroup Archive