翻译显示奇怪的字符

Amr*_*ish 5 java netbeans

我通过从翻译网站获取HTML代码翻译了一个单词.

使用NetBeans运行代码时,转换是正确的,但同时

运行jar文件,我看到未知语言...

任何帮助,请.....

来自netbeans:

来自netbeans

从jar文件:

在此输入图像描述

代码 :

`/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication5;

import java.util.ArrayList;
import java.util.Scanner;

import javax.swing.JOptionPane;

public class Main {

    public static void main(String[] args) {

        String URLString = "http://www.systranet.com/dictionary/english-arabic/play";

        ArrayList<String> wordList = new ArrayList<>();

        String FlangMarker = "<span class=\"dl_target_bullet\">&diams;</span><span class=\"dl_target_word\">";
        try {
            java.net.URL url = new java.net.URL(URLString);

            Scanner input = new Scanner(url.openStream());
            while (input.hasNext()) {
                String line = input.nextLine();
                //  System.out.println(line);
                String word = "";

                if (line.contains(FlangMarker)) {
                    for (int i = FlangMarker.length(); line.charAt(i) != '<'; i++) {
                        word += line.charAt(i);

                    }
                    wordList.add(word);
                }
            }

        } catch (java.net.MalformedURLException ex) {
            System.out.println("Invalid World");
        } catch (java.io.IOException ex) {
            System.out.println("I/O Errors: no such file");
        }

        for (int i = 0; i < wordList.size(); i++) {
            JOptionPane.showMessageDialog(null, wordList.get(i));
        }

    }
}


`
Run Code Online (Sandbox Code Playgroud)

Amr*_*ish 2

通过改变解决...

Scanner input = new Scanner(url.openStream());
Run Code Online (Sandbox Code Playgroud)

到...

Scanner input = new Scanner(url.openStream(), "UTF-8");
Run Code Online (Sandbox Code Playgroud)

...以便使用适当的编码。