<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How to use Unicode/UTF-8 in PHP properly (part 1)</title>
	<atom:link href="http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/</link>
	<description>Yet another weblog</description>
	<lastBuildDate>Wed, 07 Jul 2010 22:18:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: AHSauge</title>
		<link>http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/comment-page-1/#comment-2038</link>
		<dc:creator>AHSauge</dc:creator>
		<pubDate>Wed, 07 Jul 2010 22:18:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.varslashlog.com/?p=119#comment-2038</guid>
		<description>Hi!

I&#039;m not suprised that &quot;set names&quot; don&#039;t work with MS Access, as it&#039;s MySQL-spesific SQL. Unfortunatly, don&#039;t know how it&#039;s done with MS Access. The only tip I have is to look at the documentaton for Access and/or google it.</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>I&#8217;m not suprised that &#8220;set names&#8221; don&#8217;t work with MS Access, as it&#8217;s MySQL-spesific SQL. Unfortunatly, don&#8217;t know how it&#8217;s done with MS Access. The only tip I have is to look at the documentaton for Access and/or google it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stylus</title>
		<link>http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/comment-page-1/#comment-2037</link>
		<dc:creator>stylus</dc:creator>
		<pubDate>Wed, 07 Jul 2010 10:43:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.varslashlog.com/?p=119#comment-2037</guid>
		<description>I am using ODBC(ms access), &quot;set names &#039;utf-8&#039;&quot;, not woking with odbc_exec()or odbc_do(),, how can i save ,update unicode data in access database .
  
  Thank you,
     Stylus</description>
		<content:encoded><![CDATA[<p>I am using ODBC(ms access), &#8220;set names &#8216;utf-8&#8242;&#8221;, not woking with odbc_exec()or odbc_do(),, how can i save ,update unicode data in access database .</p>
<p>  Thank you,<br />
     Stylus</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George Garchagudashvili</title>
		<link>http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/comment-page-1/#comment-2005</link>
		<dc:creator>George Garchagudashvili</dc:creator>
		<pubDate>Wed, 23 Sep 2009 09:30:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.varslashlog.com/?p=119#comment-2005</guid>
		<description>Very helpful, thanks too much...</description>
		<content:encoded><![CDATA[<p>Very helpful, thanks too much&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Navigator</title>
		<link>http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/comment-page-1/#comment-1668</link>
		<dc:creator>Navigator</dc:creator>
		<pubDate>Wed, 03 Jun 2009 10:12:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.varslashlog.com/?p=119#comment-1668</guid>
		<description>Great article! Thanks! :)</description>
		<content:encoded><![CDATA[<p>Great article! Thanks! <img src='http://www.varslashlog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ziad Hilal</title>
		<link>http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/comment-page-1/#comment-1126</link>
		<dc:creator>Ziad Hilal</dc:creator>
		<pubDate>Fri, 15 May 2009 20:32:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.varslashlog.com/?p=119#comment-1126</guid>
		<description>Thanks for the great reply!</description>
		<content:encoded><![CDATA[<p>Thanks for the great reply!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AHSauge</title>
		<link>http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/comment-page-1/#comment-732</link>
		<dc:creator>AHSauge</dc:creator>
		<pubDate>Sat, 02 May 2009 23:55:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.varslashlog.com/?p=119#comment-732</guid>
		<description>As far as I can see, PHP6 will definitely solve more or less all current problems with PHP and Unicode/UTF-8. It will provide top-to-bottom built-in support for Unicode (both UTF-8 and UTF-16) using Unicode-enabled versions of existing functions etc. and a new datatype for Unicode-strings. Though I too fear that it might take a while before it&#039;s available at most hosting companies. The switching to PHP5 took years, and I fear we&#039;ll be looking at similar times for PHP6 too, which basically means that we&#039;re looking at years before you can assume your users have PHP6 available at their host. However, the Unicode semantics can be set to off as default in php.ini (and turned on at runtime), so the Unicode shouldn&#039;t be that much of a problem for the hosts, but there are other changes in PHP 6 too ... Hopefully some hosts might be sensible and default to PHP5 while also offering possibility to convert to a server with PHP6.

As for your question about htmlspecialchars: If and/or when you use it is up to you. From a performance point of view, it&#039;s better to do it once before you store it instead of doing it multiple times afterwards (at each request), and I can&#039;t see any benefits of doing it at each request vs. before storing. Any editing would require html entities for at least &lt; and &gt; anyway to prevent injection of malicious (X)HTML, and any entities will show up as normal characters in input and textareas even after using htmlspecialchars, so there&#039;s no real drawback doing it before. As for the Unicode/UTF-8 side of it, there&#039;s no difference from single byte charsets except that you have to add &#039;UTF-8&#039; as the 3. parameter. Actually, stricly speaking, you don&#039;t even need to add the paramter at all, as it&#039;s only going to convert &lt; &gt; &amp; &#039; and &quot; to entities which are all ASCII-characters anyway (which are stored the exact same way in UTF-8, hence ASCII-compatible).

PS: It&#039;s worth noting that this does not apply for htmlentities which converts alot more than just those five characters, and in my opinion shouldn&#039;t be used with Unicode/UTF-8 as it sort of defeats the point of using Unicode/UTF-8.</description>
		<content:encoded><![CDATA[<p>As far as I can see, PHP6 will definitely solve more or less all current problems with PHP and Unicode/UTF-8. It will provide top-to-bottom built-in support for Unicode (both UTF-8 and UTF-16) using Unicode-enabled versions of existing functions etc. and a new datatype for Unicode-strings. Though I too fear that it might take a while before it&#8217;s available at most hosting companies. The switching to PHP5 took years, and I fear we&#8217;ll be looking at similar times for PHP6 too, which basically means that we&#8217;re looking at years before you can assume your users have PHP6 available at their host. However, the Unicode semantics can be set to off as default in php.ini (and turned on at runtime), so the Unicode shouldn&#8217;t be that much of a problem for the hosts, but there are other changes in PHP 6 too &#8230; Hopefully some hosts might be sensible and default to PHP5 while also offering possibility to convert to a server with PHP6.</p>
<p>As for your question about htmlspecialchars: If and/or when you use it is up to you. From a performance point of view, it&#8217;s better to do it once before you store it instead of doing it multiple times afterwards (at each request), and I can&#8217;t see any benefits of doing it at each request vs. before storing. Any editing would require html entities for at least < and > anyway to prevent injection of malicious (X)HTML, and any entities will show up as normal characters in input and textareas even after using htmlspecialchars, so there&#8217;s no real drawback doing it before. As for the Unicode/UTF-8 side of it, there&#8217;s no difference from single byte charsets except that you have to add &#8216;UTF-8&#8242; as the 3. parameter. Actually, stricly speaking, you don&#8217;t even need to add the paramter at all, as it&#8217;s only going to convert <> &#038; &#8216; and &#8221; to entities which are all ASCII-characters anyway (which are stored the exact same way in UTF-8, hence ASCII-compatible).</p>
<p>PS: It&#8217;s worth noting that this does not apply for htmlentities which converts alot more than just those five characters, and in my opinion shouldn&#8217;t be used with Unicode/UTF-8 as it sort of defeats the point of using Unicode/UTF-8.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ziad Hilal</title>
		<link>http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/comment-page-1/#comment-730</link>
		<dc:creator>Ziad Hilal</dc:creator>
		<pubDate>Sat, 02 May 2009 22:44:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.varslashlog.com/?p=119#comment-730</guid>
		<description>Great article, hopefully PHP 6 will solve most of these common unicode problems by switching to multibyte string functions. However, I can&#039;t imagine the time it would take to get most hosting companies to update to version 6.

Here&#039;s something I would like to know, when using unicode should we htmlspecialchars() the data before entering the database? Or leave data as is, and only htmlspecialchars() the output from the database?

I&#039;m looking forward to your next article on this subject!</description>
		<content:encoded><![CDATA[<p>Great article, hopefully PHP 6 will solve most of these common unicode problems by switching to multibyte string functions. However, I can&#8217;t imagine the time it would take to get most hosting companies to update to version 6.</p>
<p>Here&#8217;s something I would like to know, when using unicode should we htmlspecialchars() the data before entering the database? Or leave data as is, and only htmlspecialchars() the output from the database?</p>
<p>I&#8217;m looking forward to your next article on this subject!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oleg</title>
		<link>http://www.varslashlog.com/2009/02/09/how-to-use-unicodeutf-8-in-php-properly-part-1/comment-page-1/#comment-397</link>
		<dc:creator>Oleg</dc:creator>
		<pubDate>Tue, 14 Apr 2009 17:32:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.varslashlog.com/?p=119#comment-397</guid>
		<description>Thank&#039;s a lot for the post. I&#039;ve been coding (amateur-level) PHP since like 7-8 years, and I always had this encoding decoding problem. And I always had to invent something new :) That was such a shame :)</description>
		<content:encoded><![CDATA[<p>Thank&#8217;s a lot for the post. I&#8217;ve been coding (amateur-level) PHP since like 7-8 years, and I always had this encoding decoding problem. And I always had to invent something new <img src='http://www.varslashlog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  That was such a shame <img src='http://www.varslashlog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
