Search code examples
javascripthtmlspecial-characters

Why are my special characters '>>' being replaced with diamonds with question marks?


here are the two lines of code in which I'm printing the special characters '>' and '>>'. however, they are being displayed as diamonds w question marks on the webpage.

paginationHtml = paginationHtml+\"<a href='javascript:void(0)' onclick='getCommentList(\"+next_page+\")'>Next› </a>&nbsp\";
paginationHtml = paginationHtml+\"<a href='javascript:void(0)' onclick='getCommentList(\"+page_count+\")'>Last» </a>&nbsp\";

Solution

  • The problem was I needed to change the encoding of my file. In PHPStorm, go to 'File' then 'File Encoding'. For me, I needed to choose 'UTF-8' encoding. I converted the code and now the ">>" characters show up fine in the website!