我想更改 mht 文件的字符集。所以我用ihtmldocument2::put_charset
如果文件没有元标记字符集,它确实有效。如果文件有 Meta 标签,put_charset 不起作用。
这是我的代码。
LPDISPATCH lpDisp;
m_webBrowser->get_Document(&lpDisp);
lpDisp->QueryInterface(IID_IHTMLDocument2,(void**)&m_htmlDocument);
m_htmlDocument->put_charset(L"utf-8");
_variant_t rl=1L;
m_webBrowser->Refresh2(&rl);