将unicode文本从mysql提取到java [英] extracting unicode text from mysql to java
问题描述
我在我的数据库中有一个表'test',列'msg'存储各种语言(如英语,印地语,泰卢固语等)的字符串。
这些字符串在数据库中正确显示。
但是如果我把它提取到我的java代码,并使用 system.out.println
在控制台上打印它,它显示 ??? 而不是实际的字符串。
I have a table 'test' in my database with a column 'msg' that stores strings in various languages like English, Hindi, Telugu, etc.
These strings are displayed properly in the database.
But if i extract it into my java code and print it on the console using system.out.println
, it shows ????????? instead of the actual string.
这是因为eclipse控制台中使用的字体不支持这些脚本吗?如果是这样,我如何将字体更改为别的?
Is this because the font used in eclipse console does not support these scripts? If so, how can i change the font to something else?
推荐答案
不能使用默认设置在控制台上打印UTF-8字符。确保用于显示输出的控制台也以UTF-8编码。
You cannot print the UTF-8 characters on console with its default settings. Make sure the console you use to display the output is also encoded in UTF-8.
在Eclipse中,您需要转到运行配置>通用
- >编码 - >选择UTF-
In Eclipse for example, you need to go to Run Configuration > Common -> Encoding -> Select UTF-8 from dropdown.
这篇关于将unicode文本从mysql提取到java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!