JavaFX Webview不好的编码 [英] JavaFX Webview bad encoding

查看:244
本文介绍了JavaFX Webview不好的编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在java中打开一个webview并显示spotify登录页面。 ( https://accounts.spotify.com/en/login ):

I try to open a webview in java and show the spotify login page. (https://accounts.spotify.com/en/login):

JFrame f = new JFrame();
    f.setTitle("Spotify");
    f.setSize(500,500);
    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFXPanel jfxPanel = new JFXPanel();
    f.add(jfxPanel);
    Platform.runLater(() -> {
        WebView webView = new WebView();
        jfxPanel.setScene(new Scene(webView));
        WebEngine webEngine = webView.getEngine();
        webEngine.load("https://accounts.spotify.com/en/login");
    });

结果是下面的窗口。 (当我复制隐藏文本并将其粘贴到另一个应用程序中时,它会显示正确编码的文本

如何以正确的编码显示spotify登录页面?

The result is the window below. (when i copy the cryptic text and paste it in another application, it shows me the text with right encoding.
How can I display the spotify login page with correct encoding?

http://fs2.directupload.net/images/150909/ zyk25eqz.png

推荐答案

我看到在我的WebView中的dropbox登录页面。

I saw this at the dropbox login page in my WebView, too.

遇到的问题无关紧要使用编码
JavaFx WebView在加载本地字体时遇到一些问题
如果您加载了要加载计算机上安装的本地字体的网站,您将看到这个隐藏的字母
如果你删除字体,你会像往常一样看到文本。

The problem you encountered has nothing to do with encoding. The JavaFx WebView has some problems with loading local fonts. If you load a website which wants to load a local font installed on your computer you will see this cryptic letters. If you remove the font you will see the text as usual.

所以你的问题不是网站的编码,它是字体spotify想要加载,你有您的电脑上的本地。

So your problem isn't the encoding of the website, it's the font spotify want's to load and you are having local on your pc.

您必须找到一种方法来阻止WebView加载本地字体。
也许通过注入一些代码。

You will have to find a way to stop the WebView from loading local fonts. Maybe by injecting some code.

这篇关于JavaFX Webview不好的编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆