java中ASCII到UTF-8的转换
我有一个问题,我使用 .CSV 文件格式上传数据,并由 java 类读取。我将存储在 db 中。现在没问题了,但是当我从 db 读取数据时,数据包含一些特殊字符。
所以请你在这里帮助我
提前谢谢。
i have a problem which i uploaded data using .CSV file format and it read by java class.and i would be store in db.upto now no problem,but when i read the data from db then data contains some special characters.
so please could you help me here
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ASCII-7 与 UTF-8 兼容。您无需执行任何操作即可将 ASCII-7 转换为 UTF-8(但反之则不起作用)
ASCII-7 is compatible with UTF-8. There is nothing you need to do turn turn ASCII-7 into UTF-8 (but it doesn't work the other way)
这是一篇你真正应该阅读的文章。
每个软件开发人员绝对必须了解 Unicode 和字符集的绝对最低限度(没有任何借口!)
接下来,回答您的问题:
要读取使用 UTF-8 编码的文件,请使用
BufferedReader
:要写入文件使用 UTF-8 编码使用
BufferedWriter
:确保通过套接字的数据传输正确。
This is an article you should really read.
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
Next, to answer your question:
To Read a file encoded with UTF-8, use a
BufferedReader
:To Write a file encoded with UTF-8 use a
BufferedWriter
:Make sure that the transmittion of the data through the sockets goes correct.