Android应用程序中西班牙语字符的问题
我对 java 字符串中的西班牙语字符有疑问。我有一个内容 RSS 提要,当我尝试使用 InputStreamReader 将其转换为 java 对象时,我得到类似“cómo”的输出,它应该是“cómo”。其他西班牙语字符也会发生这种情况,例如
á = á é = é í = ó = à ú = Á
等。
如何将这些字符转换为正确的西班牙语字符?
这是我的 InputStreamReader 的样子:
Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"), 1024);
提前致谢
I have issue with spanish characters in java string. I have a content RSS feed and when i try to transform it to java object using InputStreamReader, I get outputs like "cómo" which should be "cómo". This is happening with other spanish characters like
á = á é = é í = à ó = ó ú = ú
and more..
How can I convert these characters to proper spanish characters?
Here is how my InputStreamReader looks like:
Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"), 1024);
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您在 LogCat 中看到此字符,则不支持 UTF-8。 =)
或更改缓冲区大小,可能使用::
if you are seeing this characters in the LogCat does not support UTF-8. =)
or change your buffer size maybe using ::
这对我有用。就我而言,我正在从网站读取一个以 Ansi 编码的 .txt 文件。
This worked for me. In my case I was reading a .txt file from a website, which was encoded in Ansi.