0

I have a problem with some symbols in UTF-8 encoding. I am reading the index.html from http://wordki.pl to get the list of sets of words with their name.

it looks like this

<a href="THE LINK.html">THE NAME</a><span>(20)</span><img src="krecha.png">

and when THE NAME has "Ł" it doesent work and puts there "??" but the "??" is not a sign that i can change with replaceAll("str", "str") because my console just doesent show the char hidden behind it.

But when i view the source in chrome/firefox etc it shows "Ł". And all the other funny signs like "ó, ł, ą, ś" work fine in my program.

So I am asking if there is a way to change the "??" into "Ł" ? I tried encoding it byte by byte but then i lose all the other signs like "ó, ł, ą" etc.

EDIT: Ok i have the problem solved I needed to save my *.java file as UTF-8 : O

0

1 Answer 1

1

You should set the page content-type as "UTF-8"

Do something like this:

request.getCharacterEncoding() = ISO-8859-1 
response.getCharacterEncoding() = UTF-8 
request.getParameter("query") = déjeuner

OR

  if(null == request.getCharacterEncoding())       
     request.setCharacterEncoding(encoding); 

  response.setContentType("text/html; charset=UTF-8");  
  response.setCharacterEncoding("UTF-8");

Refer this URL for more info:

How to get UTF-8 working in Java webapps?

<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 
Sign up to request clarification or add additional context in comments.

3 Comments

1. the website isnt mine 2. it has this line
added some more info in my answer.
The problem was that my java file was not in UTF-8 so it coudlnt show a char that is only in utf-8. Thx all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.