Java不支持拉丁字符 [英] java does not support latin characters

查看:76
本文介绍了Java不支持拉丁字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Eclipse中运行以下Java程序.我的字符串包含拉丁字符.当我打印字符串时,看起来有些奇怪.这是我的代码

I am running the following java program in eclipse. My string contain latin character.When I am printing the string it looks some weird. Here my code is

    String sample = "tést";
    System.out.println(sample);

输出:

    t?st

请帮助我.预先感谢

推荐答案

如果您正在Eclipse中运行此程序并从Eclipse的控制台中读取输出,请尝试以下操作:

If you're running this in Eclipse and reading the output from Eclipse's console, try this:

  • 打开运行配置(菜单 Run > 运行配置)
  • 找到您正在使用的运行配置
  • 转到该配置的 Common 标签
  • 编码部分中,选择UTF-8
  • Open Run Configurations (Menu Run > Run Configurations)
  • Find the run configuration you're using
  • Go to Common tab for that configuration
  • In Encoding section choose UTF-8

这篇关于Java不支持拉丁字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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