在WPF Web浏览器控件中显示Unicode

时间:2015-07-29 15:50:31

标签: wpf unicode webbrowser-control

我试图在WPF WebBrowser控件中的html字符串中显示unicode字符,但它似乎不起作用。我使用以下html:

<html>
    <head>
        <title/>
    </head>
    <body>
        <div>Łuk zwykły</div>
    </body>
</html>

我已将IE仿真设置为IE 11(11000)并设置默认字符集:

 DirectCast(CurrentWebBrowser.Document, IHTMLDocument2).defaultCharset = "UTF-8"

该文件是UTF-8,但这是显示的内容:

ÅukzwykÅ,yy

1 个答案:

答案 0 :(得分:3)

您可以在HTML中指定编码

import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtMultimedia 5.0

ApplicationWindow {
    title: qsTr("Hello Video")
    width: 640
    height: 480
    visible: true

MediaPlayer {
    id: mediaplayer
   // if uncommented, can get duration of video onPressed
   // source: "file:///Users/.../testVideo.mp4"
}

VideoOutput {
    anchors.fill: parent
    source: mediaplayer
}

MouseArea {
    id: playArea
    anchors.fill: parent
    onPressed: {
        // --- If video loaded here, duration is set to 0
        mediaplayer.source= "file:///Users/...../test.mp4"
        console.debug("main::MouseArea::onPressed() - Found media with duration:" + mediaplayer.duration)
        mediaplayer.play();
    }
}