Reputation: 4921
Am am reading html text from a resourse file as
InputStream fstream = this.getClass().getClassLoader()
.getResourceAsStream(filename);
myString = IOUtils.toString(fstream, "UTF-8");
But if html contains special chars as
McDonald's
it convert it to McDonald?s
, i can resolve it if i replace '
with apos
but is there any other way to do it. is it some encoding isseu?? as its very much tedious to replace every single char since my file contains these special chars in thousands.
Thanks,
Upvotes: 3
Views: 2130
Reputation:
use this meta tag intead of utf8 if your site is in english language for multiple languages you have to use utf8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
Upvotes: 1
Reputation: 42010
Try a different encoding. Possibly be Cp1252
or ISO-8859-1
. You can find more character encodings in http://www.iana.org/assignments/character-sets (use the preferred MIME name) or take at look in Character encoding - Wikipedia, the free encyclopedia.
Upvotes: 1