English 中文(简体)
如何在 html 中创建特殊字符
原标题:How to render special characters in html

Am 正在读取 html 文档中的 html 文本 。

InputStream fstream = this.getClass().getClassLoader()
        .getResourceAsStream(filename);
myString = IOUtils.toString(fstream, "UTF-8");

但如果 html 含有特殊字符

McDonald s

它转换为 McDonald?s ,如果我用 替换 ,我可以解决它,但还有其他方法可以解决它。 它是否具有某种编码 isseu? 因为它非常讨厌替换每一个字符, 因为我的文件以千计包含这些特殊字符 。

谢谢

问题回答

尝试不同的编码 。 可能是 Cp1252 ISO- 8859-1 。 您可以在 < a href=" http://www. iana. org/ travelments/character- sets" rel=“ nofollow” > http://www.iana. org/travites/character- sets (使用 ppoedered MIME name ) 中找到更多的字符编码, 或者在 < a href=" http://en.wikipedia.org/wiki/Character_encoding#common_character_encodings" rel=“nofolpolation> > Character Compte-Wikedia, 免费的百科全书 < a > 。

如果您的网站是英语语言, 您必须使用 utf8 的多种语言, 请使用此 utf8 的元标记 。

 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签