Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem is that programs have different ways of representing different characters. This is referred to as character encoding. Your browser, server, and PHP code are currently confused about which encoding you are using because you are mixing <code>UTF-8</code> characters with <code>ANSI</code> code. </p> <p>You can learn more about encoding here: <a href="http://vlaurie.com/computers2/Articles/characters.htm" rel="nofollow noreferrer">http://vlaurie.com/computers2/Articles/characters.htm</a></p> <p>There are three things that I do whenever I build a UTF-8 PHP site. These three things should resolve your problem:</p> <h3>Add a PHP UTF-8 Header</h3> <p>Add this to the top of your code:</p> <pre><code>&lt;?php header('Content-Type: text/html; charset=utf-8'); ... </code></pre> <p>I believe that this instructs other servers and your browser to parse this document using UTF-8, instead of ANSI. You can read more about this here: <a href="https://stackoverflow.com/questions/4279282/set-http-header-to-utf-8-php">Set HTTP header to UTF-8 using PHP</a></p> <h3>Add HTML UTF-8 Meta Tags</h3> <p>Add this code to the top of the HTML that you return:</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt; ... </code></pre> <p>This also instructs your browser to read the characters in UTF-8 (instead of ANSI). You can read more about this here: <a href="https://stackoverflow.com/questions/4279282/set-http-header-to-utf-8-php">Set HTTP header to UTF-8 using PHP</a></p> <h3>Save the PHP File as UTF-8 without BOM</h3> <p>By default, your files usually save in <code>ANSI</code> encoding<code>. If you want to work with international characters, then you need to save them in</code>UTF-8<code>encoding. This will let you work with the</code>Å` character properly.</p> <p>If you are Notepad++ as your Text Editor, then you can set the encoding of your document under the Encoding menu. Set it to <code>Encode in UTF-8 without BOM</code>.</p> <p><em>Gotcha</em></p> <p><code>UTF-8 without BOM</code> is not the same thing as <code>UTF-8</code>. UTF-8 files are often prepended with 3 bytes of data that indicate that the file is a UTF-8 file. This is referred to as the <code>Byte Order Mark</code> (BOM). You can read more about the BOM here: <a href="http://www.arclab.com/products/amlc/utf-8-php-cannot-modify-header-information.html" rel="nofollow noreferrer">http://www.arclab.com/products/amlc/utf-8-php-cannot-modify-header-information.html</a></p> <p>Most programs can tell that the file is UTF-8 anyway, so the BOM is redundant. If you don't save without the BOM, you'll probably get an error message like this:</p> <pre><code>Warning: Cannot modify header information – headers already sent </code></pre> <p>If you see this error message, then you probably have a BOM problem.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload