<?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>infinite possibility &#187; PHP</title>
	<atom:link href="http://anypossibility.com/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://anypossibility.com/blog</link>
	<description>Naoko Reeves&#039;s Blog</description>
	<lastBuildDate>Tue, 31 Jan 2012 12:32:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Latin 1 to UTF-8</title>
		<link>http://anypossibility.com/blog/2010/08/latin-1-to-utf-8-2/</link>
		<comments>http://anypossibility.com/blog/2010/08/latin-1-to-utf-8-2/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 14:35:49 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=105</guid>
		<description><![CDATA[Long story short, I was doing some screen scraping on web application. My web app use Latin 1 and target is using UTF-8. So I had a few issues to resolve in order for it to work&#8230; 1. Display Issue: If target site has beyond ascii character, it wasn&#8217;t displaying correctly. To resolve this was [...]]]></description>
			<content:encoded><![CDATA[<p>Long story short, I was doing some screen scraping on web application. My web app use Latin 1 and target is using UTF-8. So I had a few issues to resolve in order for it to work&#8230;</p>
<p>1. Display Issue: If target site has beyond ascii character, it wasn&#8217;t displaying correctly. To resolve this was easy. I walk through the characters and replaced with html encode if character code is higher than base ascii&#8230;.(yes i know&#8230; the scripting language that I use doesn&#8217;t offer nice libraries&#8230;)</p>
<p>2. Posting Issue: This was the pain one&#8230; because my web app use Latin 1, anything higher than ascii is translated as HTML Encoding. So to post to UTF-8 site, there are 2 steps involving. (1) Convert HTML Encoded character to Unicode (2) Convert Unicode to URL Encode<br />
2.1. Convert HTML Encoded character to Unicode: This is very simple. Basically use this regenx pattern &#8220;&#[0-9]{3.5};&#8221; to look for HTML Encoded character and extract numeric only and wrap with command to convert it to character (for instance in php it is chr).</p>
<p>2.2. Convert Unicode to URL Encode: Now that you have Unicode prepared, all you have to do is to do url-encoding! (and no, the scripting language i use doesn&#8217;t offer native solution. and yes, I have plan to switch scripting language. so this is for person like me who stuck with language that offers very limited set of libary)<br />
2.2.1. My First Attempt: use curl &#8211;data-urlencode option. Please note that this was added in version 7.18.0. If you are Mac user like me, you can install/upgrade curl using MacPorts or you can download source from here and install. Unfortunately I could not use this option&#8230; because there is one restriction to this &#8211; &#8220;content cannot contain = or @ symbols, as that will then make the syntax match&#8221;.<br />
2.2.2.My Second Attempt: Relies on Shell&#8230; Now this is almost always works! I decided to use php rawurlencode. Calling like this from terminal works like a charm.</p>
<blockquote><p>$ php -r &#8220;echo rawurlencode(&#8216;ξακσλξ&#8217;)</p></blockquote>
<p>Issue the command via plugin to execute shell command did not work. It is not unicode supported so it end up returning url encode of ??????<br />
I contacted plugin vendor and he is planning to release unicode support soon&#8230; so until then somehow </p>
<p>My co-worker found this article: http://akameng.com/web/php_utf_unicode_convertor. Ooooo, this shows the formula to how to convert this using integer division and multiplication without using bitwise operation. <a href="http://home.tiscali.nl/t876506/utf8tbl.html">This article</a> also explains this formula.<br />
If ud <128 (7F hex) then UTF-8 is 1 byte long, the value of ud.</p>
<blockquote><p>If ud >=128 and <=2047 (7FF hex) then UTF-8 is 2 bytes long.<br />
   byte 1 = 192 + (ud div 64)<br />
   byte 2 = 128 + (ud mod 64)</p></blockquote>
<p>So as a final product (for now) I have code like this:</p>
<blockquote><p>$ php -r &#8220;echo rawurlencode(chr(206).chr(190).chr(32).chr(32).chr(195).chr(169).chr(110).chr(100));&#8221;</p></blockquote>
<p>I am done for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/08/latin-1-to-utf-8-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install NetBeans 6.9 to OS X 10.5.8</title>
		<link>http://anypossibility.com/blog/2010/07/install-netbeans-6-9-to-os-x-10-5-8/</link>
		<comments>http://anypossibility.com/blog/2010/07/install-netbeans-6-9-to-os-x-10-5-8/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 23:23:34 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=4</guid>
		<description><![CDATA[NetBeans 6.9 is a great PHP IDE and I have been pretty happy about it. Although initially, I almost gave up installing this on my MacBook Pro &#8211; After installation was done and launch the application I have encountered an error saying &#8220;Cannot run on older version of Java 6 Standard Edition. Please install Java [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://netbeans.org/features/php/">NetBeans 6.9</a> is a great PHP IDE and I have been pretty happy about it. Although initially, I almost gave up installing this on my MacBook Pro &#8211; After installation was done and launch the application I have encountered an error saying &#8220;<em>Cannot run on older version of Java 6 Standard Edition.<br />
Please install Java 6 Standard Edition or newer or use &#8211;jdkhome switch to point to its installation directory.</em>&#8221;</p>
<p><strong>To solve this problem</strong>:</p>
<p>Application: Utilities: Java Preference &gt;&gt; Drag Java SE 6 to the top</p>
<p><strong>If this doesn&#8217;t fix the issue try</strong>:</p>
<p>Terminal: type &#8220;env&#8221;. Do you see JAVA_HOME is defined? If so, is this pointing to older version? If so fixing that should resolve the issue (at least it resolved my case). Here is how I fixed:</p>
<ol>
<li>my JAVA_HOME was set to<br />
<blockquote><p><code>/Library/Java/Home</code></p></blockquote>
<p> which was simply the symlink to </p>
<blockquote><p><code>System/Library/Frameworks/ JavaVM.framework/Versions/1.5.0/Home</code></p></blockquote>
</li>
<li>rename the symlink to Home_old</li>
<li>then create new symlink point to 1.6 (SE 6) as follows: ln -s<br />
<blockquote><p><code>/System/Library/Frameworks/ JavaVM.framework/Versions/1.6.0/Home /Library/Java/Home</code></p></blockquote>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/07/install-netbeans-6-9-to-os-x-10-5-8/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

