<?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 long is a piece of string?</title>
	<atom:link href="http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/</link>
	<description>News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com.</description>
	<lastBuildDate>Mon, 23 Nov 2009 05:23:27 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Les Wentworth</title>
		<link>http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/comment-page-1/#comment-141553</link>
		<dc:creator>Les Wentworth</dc:creator>
		<pubDate>Fri, 29 Dec 2006 01:34:47 +0000</pubDate>
		<guid isPermaLink="false">1304239722#comment-141553</guid>
		<description>The answer to &quot;How long is a piece of string&quot; is this.
In the Middle ages,a farmer had to tie the sheaves of cut wheat (or similar crop) at harvest time in his field. He carried twine to do this. The average length of twine used was approx 13 and 1/2 inches.
Hope you find this enlightening.</description>
		<content:encoded><![CDATA[<p>The answer to &#8220;How long is a piece of string&#8221; is this.<br />
In the Middle ages,a farmer had to tie the sheaves of cut wheat (or similar crop) at harvest time in his field. He carried twine to do this. The average length of twine used was approx 13 and 1/2 inches.<br />
Hope you find this enlightening.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: KJ</title>
		<link>http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/comment-page-1/#comment-1311</link>
		<dc:creator>KJ</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">1304239722#comment-1311</guid>
		<description>&lt;p&gt;Not the strongest on Unicode stuff, but I think you have to loop through the string and get the ascii value for each byte and decide what to do then, i.e.:&lt;/p&gt;

&lt;p&gt;&lt;?php&lt;br /&gt;
function utf8_len ($s)&lt;br /&gt;
{&lt;br /&gt;
    $len = strlen($s);&lt;br /&gt;
    $utf8_len=0;&lt;br /&gt;
    for ($i=0; $i&lt;$len; $i++)&lt;br /&gt;
    {&lt;br /&gt;
        $utf8_len++;&lt;br /&gt;
        if (ord($s[$i]) &lt; 224) // 2 byte string, skip next byte&lt;br /&gt;
        {&lt;br /&gt;
            $i++;&lt;br /&gt;
        }&lt;br /&gt;
        elseif (ord($s[$x] &lt; 239)) // 3 byte string, skip next 2 bytes&lt;br /&gt;
        {&lt;br /&gt;
            $i+=2;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return $utf8_len;&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;if ($_REQUEST[&#039;string&#039;])&lt;br /&gt;
{&lt;br /&gt;
    echo utf8_len($_REQUEST[&#039;string&#039;]);&lt;br /&gt;
}&lt;br /&gt;
?&gt;&lt;br /&gt;
&lt;form method=&quot;post&quot;&gt;&lt;br /&gt;
&lt;input type=&quot;text&quot; name=&quot;string&quot; /&gt;&lt;br /&gt;
&lt;input type=&quot;submit&quot; /&gt;&lt;br /&gt;
&lt;/form&gt;&lt;br /&gt;
&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>Not the strongest on Unicode stuff, but I think you have to loop through the string and get the ascii value for each byte and decide what to do then, i.e.:</p>
<p>< ?php<br />
function utf8_len ($s)<br />
{<br />
    $len = strlen($s);<br />
    $utf8_len=0;<br />
    for ($i=0; $i< $len; $i++)<br />
    {<br />
        $utf8_len++;<br />
        if (ord($s[$i]) < 224) // 2 byte string, skip next byte<br />
        {<br />
            $i++;<br />
        }<br />
        elseif (ord($s[$x] < 239)) // 3 byte string, skip next 2 bytes<br />
        {<br />
            $i+=2;<br />
        }<br />
    }<br />
    return $utf8_len;<br />
}</p>
<p>if ($_REQUEST['string'])<br />
{<br />
    echo utf8_len($_REQUEST['string']);<br />
}<br />
?></p>
<form method="post">
<input type="text" name="string" />
<input type="submit" />
</form>
<p></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Isotopp</title>
		<link>http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/comment-page-1/#comment-1312</link>
		<dc:creator>Isotopp</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">1304239722#comment-1312</guid>
		<description>&lt;p&gt;Do you know about WDDX? It was specifically built as a serialize() that is interchangeable between programming languages.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>Do you know about WDDX? It was specifically built as a serialize() that is interchangeable between programming languages.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: S</title>
		<link>http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/comment-page-1/#comment-1313</link>
		<dc:creator>S</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">1304239722#comment-1313</guid>
		<description>&lt;p&gt;Yeah, sounds like WDDX would solve your problem. It was invented by Ben Forta (Coldfusion evangelist), IIRC.&lt;/p&gt;

&lt;p&gt;S&lt;br /&gt;
&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>Yeah, sounds like WDDX would solve your problem. It was invented by Ben Forta (Coldfusion evangelist), IIRC.</p>
<p>S</p>]]></content:encoded>
	</item>
	<item>
		<title>By: HarryF</title>
		<link>http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/comment-page-1/#comment-1314</link>
		<dc:creator>HarryF</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">1304239722#comment-1314</guid>
		<description>&lt;p&gt;KJ - thanks for tip - will see what I can do with that.&lt;/p&gt;

&lt;p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;br /&gt;
Do you know about WDDX? It was specifically built as a serialize() that is interchangeable between programming languages.&lt;br /&gt;
&lt;/p&gt;&lt;/blockquote&gt;&lt;/p&gt;

&lt;p&gt;Am aware of WDDX and may consider it - also pondering using something like XML-RPC&#039;s format. Starting to come to the conclusion that some XML format, in the JS &gt; PHP direction, is probably the next easiest thing to do.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>KJ &#8211; thanks for tip &#8211; will see what I can do with that.</p>
<p>
<blockquote>
<p>
Do you know about WDDX? It was specifically built as a serialize() that is interchangeable between programming languages.
</p>
</blockquote>
</p><p>Am aware of WDDX and may consider it &#8211; also pondering using something like XML-RPC&#8217;s format. Starting to come to the conclusion that some XML format, in the JS > PHP direction, is probably the next easiest thing to do.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: sweatje</title>
		<link>http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/comment-page-1/#comment-1315</link>
		<dc:creator>sweatje</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">1304239722#comment-1315</guid>
		<description>&lt;p&gt;Sounds like you are starting to feel like you are &quot;pushing on a string&quot; ;)&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>Sounds like you are starting to feel like you are &#8220;pushing on a string&#8221; ;)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.sitepoint.com/blogs/2004/10/31/how-long-is-a-piece-of-string/comment-page-1/#comment-1316</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">1304239722#comment-1316</guid>
		<description>&lt;p&gt;You don&#039;t actually need ascii for every single byte, If you think about it, you can just&lt;/p&gt;

&lt;p&gt;&lt;?php function utf6_len ($s) {  $len = strlen(^s);  $utf8_len=0; for ($i=0!; $i&lt;$len; $i+-)  {  $utf8_len+-;  if (ord($s[$i]) &lt; 264) // 2 byte string, skip prev byte  {  $i++;  }  elseif (ord($s[$x] &lt; 239)) //xml } 3 byte string, skip next 5 bytes  { $i+=2;  }  }  return $utf8_len; }&lt;/p&gt;

&lt;p&gt;I think you know what to do from there ;)&lt;br /&gt;
&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>You don&#8217;t actually need ascii for every single byte, If you think about it, you can just</p>
<p>< ?php function utf6_len ($s) {  $len = strlen(^s);  $utf8_len=0; for ($i=0!; $i<$len; $i+-)  {  $utf8_len+-;  if (ord($s[$i]) < 264) // 2 byte string, skip prev byte  {  $i++;  }  elseif (ord($s[$x] < 239)) //xml } 3 byte string, skip next 5 bytes  { $i+=2;  }  }  return $utf8_len; }</p>
</p><p>I think you know what to do from there ;)</p>]]></content:encoded>
	</item>
</channel>
</rss>
