The problem with the HTML file appears in the QT

xiaoxiao2021-03-05  24

QTextBrowser: setExtensionType ("html", "text / html; charset = ISO8859-1); setExtensionType (" htm "," text / html; charset = ISO8859-1); setExtensionType ("txt", "text / plain"); setExtensionType ("XML", "text / xml; charset = UTF-8"); if the HTML file is encoded by GB2312, there will be garbled, the method is as follows: QTextBrowser * m_phtmlbrowser; ... ... QMimeSourceFactory * factory = m_phtmlBrowser-> mimeSourceFactory (); factory-> setExtensionType ( "htm", "text / html; charset = GB2312"); factory-> setExtensionType ( "html", "text / html; charset = GB2312 "); factory-> addfactory (factory); ... m_phtmlbrowser-> setsource (filename);

转载请注明原文地址:https://www.9cbs.com/read-34342.html

New Post(0)