更新时间:2023-12-06 13:12:28
您版本中的第一行打印出的问题很明显:
cmd->chcp:GBK
与cmd->chcp:UTF-8
在笔记本电脑和台式机上,您具有 GBK字符编码(cmd->chcp:GBK
),但您同事的PC使用 UTF-8 (cmd->chcp:UTF-8
).因此,由于您的代码也可能使用GBK编码编写,因此您同事的PC尝试解释UTF-8中的字符,但UTF-8字符空间中根本没有保留项目符号(如果有的话).>
我建议您将代码转换为Unicode,并使用\u2022
(这是项目符号的unicode编码)作为符号,而不是添加它来键入它或以任何其他方式对其进行硬编码.
I try to run javafx
Password Field Demo on my desktop
enviroment:
win7 64 cmd->chcp:GBK
java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
jdk version switch to "1.8.0_191
" and "1.8.0_131
",the same result.
then I tried to run the Demo on my colleague's desktop
win7 64 cmd->chcp:UTF-8
java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
But on my notebook
win8 64 cmd->chcp:GBK
java -version
java version "1.8.0_191"/"1.8.0_161"/"1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
It shows normally with BULLET
The very first line in your version prints the problem is clear:
cmd->chcp:GBK
vs cmd->chcp:UTF-8
On your Notebook and Desktop PC you have the GBK character encoding (cmd->chcp:GBK
) but your collegue's PC uses UTF-8 (cmd->chcp:UTF-8
). As your code therefore also is likely written with the GBK encoding, your colleague's PC tries to interpret the character in UTF-8 but the UTF-8 character space doensn't hold the bullet symbol (if any character at all) there.
I'd suggest you to convert your code to Unicode and use \u2022
(which is the unicode encoding for the bullet) as the symbol rather than add it typing it or setting it hardcoded in any other way.