gpt4 book ai didi

debugging - 在 Intellij Idea 调试器中查看 unicode 字符串

转载 作者:行者123 更新时间:2023-12-04 12:41:30 27 4
gpt4 key购买 nike

如何在 Intellij Idea 调试器数据 View 中查看 Unicode 编码的字符串?
例如考虑以下代码

String str = "सुझाव"; //some Unicode string: utf-8
String str1 = "\u0938\u0941\u091d\u093e\u0935";
System.out.println(str);

无法查看变量str - 在调试器的数据 View 中,它显示垃圾值。
即使设置值显示正确的值。

enter image description here
任何建议/解决方法?

可能在某处丢失了一些编码设置。

最佳答案

检查项目编码。我有同样的问题。 Idea 显示了 WIN-1252 中的变量内容编码。
Editor > File Encodigs 中的版本您有:IDE Encoding , 和 Project Encoding .更改后Project Encoding到 UTF-8 一切正常。

关于debugging - 在 Intellij Idea 调试器中查看 unicode 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18480700/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com