为什么这个字符口导致我的扫描仪失败?

Why is this character 口 causing my scanner to fail?

我正在使用 Java Scanner

我有一个 .txt 文件,其中保存了这段文字。

PriceDB = {
    ["profileKeys"] = {
        ["Name - 回音山"] = "Name - 回音山",
    },
    ["char"] = {
        ["Name - 回音山"] = {
            ["CurrentValue"] = "一口价:|cffffffff70,197|TInterface\MoneyFrame\UI-GoldIcon:0:0:2:0|t|r",
        },
    },
}

我想做的就是用扫描仪打开这个文件并从文件中提取 70,197"CurrentValue" 并将其保存为 int。但是,每次打开文件时,它不会读取一行并抛出一个 NoSuchElementException"No line found" 作为消息。在摆弄文件并一个一个地删除了一些汉字之后,我将范围缩小到这个小家伙口。出于某种原因,扫描器不喜欢那个字符。我只是想知道是否需要更改某些编码设置,或者我是否要使用 BufferedReader 或什么...老实说,我不太确定发生了什么,除非我猜是编码错误。那么这里发生了什么?

编辑:这是我的扫描仪的初始化。

Scanner scanner;
if (region.equals("US")) {
                scanner = new Scanner(new File("C:\Program Files\World of Warcraft\WTF\Account\313023286#1\SavedVariables\WoWTokenPrice.lua"));
            } else if (region.equals("EU")) {
                scanner = new Scanner(new File("C:\Program Files\World of Warcraft\WTF\Account\313495228#1\SavedVariables\WoWTokenPrice.lua"));
            } else if (region.equals("China")) {
                File file = new File("C:\Program Files\World of Warcraft\WTF\Account\232241227#1\SavedVariables\WoWTokenPrice.lua");
                System.out.println(file.exists());
                scanner = new Scanner(file);
            } else {
                System.exit(1);
                break;
            }

我只是照原样复制了它。区域 == "China"

创建 Scanner 时必须指定正确的编码。构造函数:

public Scanner(InputStream source, String charsetName)

Constructs a new Scanner that produces values scanned from the specified input stream. Bytes from the stream are converted into characters using the specified charset.

Find here your charset, i guess UTF-16但不是外文专家:).

Scanner scanner = new Scanner(is, StandardCharsets.UTF-16.toString());