title: PHP utf8_encode with utf8 characters included
body: <p>Background: 
  A part of my system uses utf8_encode to convert html code to utf8 format before passing it on to json_encode.</p>
  
  <p>Problem:
  Everything was fine until I entered UTF8 characters(Chinese) into the system. I noticed that the mentioned UTF8 characters were encoded twice and came out garbled. </p>
  
  <p>Sidenote:
  I have no experience with charset encoding and whatnot until now. Perhaps I don't need to use utf8_encode before json_encode since my database and connections are already set to utf8. Without the Chinese characters in the html code, mb_detect_encoding would return ASCII(not ISO-8859-1). But I couldn't get through json_encode without returning null... thus the use of utf_8 encode which worked until now.</p>
  
  <p>Update:
  I finally solved the issue by typecasting the html code as string; via (string)$html; before assigning it to json_encode().</p>
  
  <p>Thanks to all who posted here that led me to the final solution.</p>