Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: 13 Mar 2007 12:38:49 -0700,    group: microsoft.public.inetsdk.programming.urlmonikers        back       


Encoding pass trouble   
Hello,

I'm writing proxy-like implementation of IE Pluggable Protocol Handler
(for http, ftp), I have implemented IInternetProtocol and
IInternetProtocolSink with simple logic, just creating through
CoCreateClass instance of native protocol handler (reading its CLSID
from registry) and passing all calls to it.

But I have strange problems with encoding. When I try to load page
without META tag specified encoding in page body, however it is
specified in HTTP headers (Content-Encoding header) Explorer resets
page encoding to my system default codepage. When my pluggable
protocol handler is switched off IE correctly gets codepage from
header.

For example, if I try to load pages encoded in utf-8, but without tag
<meta http-equiv="content-type" content="text/html; charset=UTF-8">,
then I see page in my default encoding (windows-1251).

In debugger I see:

STDMETHODIMP MyInternetProtocolImpl::Start(..., IInternetProtocolSink
__RPC_FAR *pOIProtSink, IInternetBindInfo __RPC_FAR *pOIBindInfo ...)
{
	BINDINFO biInfo;
	memset(&biInfo,0,sizeof BINDINFO);
	biInfo.cbSize = sizeof BINDINFO;
	DWORD dwInfo;
	pOIBindInfo->GetBindInfo(&dwInfo,&biInfo);

	/// biInfo.dwCodePage == 1251. // from system defaults
	...
	// create our own instance of MyInternetProtocolSinkImpl and pass
pOIProtSink to it
}

And next point:

HRESULT STDMETHODCALLTYPE
MyInternetProtocolSinkImpl::ReportProgress(ULONG ulStatusCode,
LPCWSTR lzStatusText )
{
	...
	if(ulStatusCode == BINDSTATUS_MIMETYPEAVAILABLE)
        	{
		/// in this point lzStatusText == "text/html; codepage=UTF-8" it's
right!
            	return m_ProtocolSink->ReportProgress( ulStatusCode,
szStatusText );
		/// m_ProtocolSink - is original IInternetProtocolSink that was
passed from Start()
        	}
}

After all IE seems to lose original Content-Type header. Is there any
way to correctly pass this header to underlying Protocol Handler?

Thanks for advice.
date: 13 Mar 2007 12:38:49 -0700   author:   unknown

Re: Encoding pass trouble   
Semen.Semakov@gmail.com wrote:
> I'm writing proxy-like implementation of IE Pluggable Protocol Handler
> (for http, ftp), I have implemented IInternetProtocol and
> IInternetProtocolSink with simple logic, just creating through
> CoCreateClass instance of native protocol handler (reading its CLSID
> from registry) and passing all calls to it.
>
> But I have strange problems with encoding. When I try to load page
> without META tag specified encoding in page body, however it is
> specified in HTTP headers (Content-Encoding header) Explorer resets
> page encoding to my system default codepage. When my pluggable
> protocol handler is switched off IE correctly gets codepage from
> header.

I wrote a similar component, and I don't have this problem. See

http://groups.google.com/group/microsoft.public.inetsdk.programming.mshtml_hosting/msg/76bf4910a289d4b3

You might try to compare and figure out what you are doing differently. 
Or just use mine.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Tue, 13 Mar 2007 15:51:32 -0400   author:   Igor Tandetnik

Re: Encoding pass trouble   
On Mar 13, 10:51 pm, "Igor Tandetnik"  wrote:
> Semen.Sema...@gmail.com wrote:
> > I'm writing proxy-like implementation of IE Pluggable Protocol Handler
> > (for http, ftp), I have implemented IInternetProtocol and
> > IInternetProtocolSink with simple logic, just creating through
> > CoCreateClass instance of native protocol handler (reading its CLSID
> > from registry) and passing all calls to it.
>
> > But I have strange problems with encoding. When I try to load page
> > without META tag specified encoding in page body, however it is
> > specified in HTTP headers (Content-Encoding header) Explorer resets
> > page encoding to my system default codepage. When my pluggable
> > protocol handler is switched off IE correctly gets codepage from
> > header.
>
> I wrote a similar component, and I don't have this problem. See
>
> http://groups.google.com/group/microsoft.public.inetsdk.programming.m...
>
> You might try to compare and figure out what you are doing differently.
> Or just use mine.
> --
> With best wishes,
>     Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925

Thank you Igor, I see that
date: 14 Mar 2007 10:03:34 -0700   author:   unknown

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us