<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code / Don&#039;t Code</title>
	<atom:link href="http://inoveb.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://inoveb.com</link>
	<description>Tips and Tricks on how to create and maintain a website</description>
	<lastBuildDate>Thu, 22 Apr 2010 07:36:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>UTF-8 and websites</title>
		<link>http://inoveb.com/2010/04/20/utf-8-and-websites/</link>
		<comments>http://inoveb.com/2010/04/20/utf-8-and-websites/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 11:04:39 +0000</pubDate>
		<dc:creator>alecs</dc:creator>
				<category><![CDATA[Do]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://inoveb.com/?p=8</guid>
		<description><![CDATA[Is your website in other language than english? Does your website contain characters that are not in the english alphabet? Then you really need your website to accept UTF-8 encoding. Of course, there are more standards (ISO 8859-1, ISO 8859-2 etc), but UTF-8 gets all the characters you need.

UTF-8 and HTML &#8211; In order to [...]]]></description>
			<content:encoded><![CDATA[<p>Is your website in other language than english? Does your website contain characters that are not in the english alphabet? Then you really need your website to accept UTF-8 encoding. Of course, there are more standards (ISO 8859-1, ISO 8859-2 etc), but UTF-8 gets all the characters you need.</p>
<ol>
<li><strong>UTF-8 and HTML</strong> &#8211; In order to add UTF-8 characters in your static HTML files, open the files using an file editor (<a title="Notepad++" href="http://notepad-plus.sourceforge.net" target="_blank">Notepad++</a>, <a title="Notepad2" href="http://www.flos-freeware.ch/notepad2.html" target="_blank">Notepad2</a>) and change encoding to UTF-8;
<ul>
<li>Notepad++ : Top menu -&gt; Encoding -&gt; Encode in UTF-8</li>
<li>Notepad2 : Top Menu -&gt; File -&gt; Encoding-&gt; UTF-8</li>
</ul>
<p>For the browsers to know what encoding type you are using, add this line in the &lt;head&gt; section of your website:</p>
<blockquote><p>&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243;&gt;</p></blockquote>
</li>
<li><strong>UTF-8 and Javascript</strong> &#8211; If you need to write some sentences that will be replaced using javascript and are stored in .js files, you have to act as with HTML files;</li>
<li><strong>UTF-8 and PHP</strong> &#8211; In order to work with UTF-8 strings in PHP, act exactly as with HTML files. Add this line in your php files<br />
<blockquote><p>&lt;?php header(&#8220;Content-type: text/html; charset=utf-8&#8243;);?&gt;</p></blockquote>
<p>Be sure to not output any character before inserting this line.  Beware using functions that you must explicitly say that you want to work with UTF-8 strings, such as <a title="htmlentities" href="http://php.net/htmlentities" target="_blank">htmlentities</a> and <a title="htmlspecialchars" href="http://php.net/htmlspecialchars" target="_blank">htmlspecialchars</a>.</p>
<ul>
<li>Only the files that contain UTF-8 strings must have UTF-8 encoding.  The other .php files can be eighter UTF-8 or other Encoding format</li>
</ul>
</li>
<li><strong>UTF-8 and MySQL</strong> &#8211; If you want to store UTF-8 strings in your MySQL database, you have to make some changes to the fields you will store those strings into.  For CHAR/VARCHAR/TEXT  fields (and all derived by these), by default mysql sets Collation to  latin_swedish_ci . This encoding does not store UTF-8 characters.  So you have to change the Collation into utf_general_ci.With this done, you now have to tell PHP to communicate with mysql using UTF-8 format. In your PHP file that connects to your database, add these 2 lines right after the mysql_select_db function.<br />
<blockquote><p>mysql_query(&#8216;SET CHARACTER SET utf8&#8242;);<br />
mysql_query(&#8216;SET SESSION collation_connection =&#8221;utf8_general_ci&#8221;&#8216;);</p></blockquote>
<p>Your code should look like this:</p>
<blockquote><p>$dbconnect = @mysql_connect($mysql['host'], $mysql['username'], $mysql['password'], true) or die(&#8216;Unable to connect to server&#8217;);<br />
@mysql_select_db($mysql['db'], $dbconnect) or die(&#8216;Could not find the database&#8217;);<br />
mysql_query(&#8216;SET CHARACTER SET utf8&#8242;);<br />
mysql_query(&#8216;SET SESSION collation_connection =&#8221;utf8_general_ci&#8221;&#8216;);</p></blockquote>
</li>
</ol>
<p>Versiunea in limba Romana / Romanian Version: <a title="UTF-8 si siteurile web" href="http://inoveb.ro/2010/04/20/utf-8-si-siteurile-web/">UTF-8 si siteurile web</a></p>
]]></content:encoded>
			<wfw:commentRss>http://inoveb.com/2010/04/20/utf-8-and-websites/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
