<?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>Feed Me A Stray Cat &#187; Xcode</title>
	<atom:link href="http://www.feedmeastraycat.net/tag/xcode/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.feedmeastraycat.net</link>
	<description>Thoughts that won&#039;t interest you.</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:17:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Umlauts in hash tags in Twitter Tools</title>
		<link>http://www.feedmeastraycat.net/2011/05/28/umlauts-in-hash-tags-in-twitter-tools/</link>
		<comments>http://www.feedmeastraycat.net/2011/05/28/umlauts-in-hash-tags-in-twitter-tools/#comments</comments>
		<pubDate>Sat, 28 May 2011 21:52:19 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Coda]]></category>
		<category><![CDATA[Crowd Favorite]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Emma]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Mac App Store]]></category>
		<category><![CDATA[Panic]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Twitter Tools]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://www.feedmeastraycat.net/?p=6097</guid>
		<description><![CDATA[I use the plugin Twitter Tools to import tweets into my blog which I put in my &#8220;Lifestream&#8221; to the right. It works really good, except that it seams to have a problem with Swedish characters like Å, Ä or Ö. I haven&#8217;t had the time or the will to try to fix it. But [...]]]></description>
			<content:encoded><![CDATA[<p>I use the plugin <a href="http://wordpress.org/extend/plugins/twitter-tools/">Twitter Tools</a> to import tweets into my blog which I put in my &#8220;Lifestream&#8221; to the right. It works really good, except that it seams to have a problem with Swedish characters like Å, Ä or Ö. I haven&#8217;t had the time or the will to try to fix it. But tonight &#8230; I did.</p>
<p>So here is the problem:</p>
<p><img src="http://www.feedmeastraycat.net/uploads//tweet1.png" alt="" title="Broken tweet" width="214" height="126" class="alignnone size-full wp-image-6098" style="margin-bottom: 5px;" /><br/><small>The tag should be #GöteborgsVarvet.</small></p>
<p>I started with <em>The Google</em> and found <a href="http://wordpress.org/support/topic/plugin-twitter-tools-enable-german-umlauts-in-sidebar-widgets-solution">this</a> thread on the WordPress support forum. But I didn&#8217;t like the look of it since it just adds to the reg exp character list. I could have just added my missing characters. But what if a Norwegian dude gets Internet and starts using <em>The Twitter</em>. That won&#8217;t do.</p>
<p>So I searched some more and came up with this solution. First I changed the reg exp to this:</p>
<blockquote><pre>'/(^|\s)#([\w\pL]{1,})(\W)/u'</pre>
</blockquote>
<p>It will search for any &#8220;word character&#8221; using unicode. Which <strong>should</strong> make it find å, ä, and ö. But also &#8220;the other ones&#8221;. From other languages. Then it breaks the tag when it finds any non-word character. For example a &#8220;-&#8221; or a &#8220;(&#8221; or something like that. This brings it closer to how Twitter does it:</p>
<p><img src="http://www.feedmeastraycat.net/uploads//twitter-tweet.png" alt="" title="Twitter Tweet" width="557" height="105" class="alignnone size-full wp-image-6100" style="margin-bottom: 5px;" /><br/><small>What we see here is that Twitter gets all the strange tags, even with å or ö in them, but it breaks at the dash character.</small></p>
<p>However, I still had a problem with the reg exp. It couldn&#8217;t find tags in a row. If the tweet had three tags in a row it only matched the first and the last. I solved this, ugly, by first changing all white spaces to double white spaces. And after the hash tag match I change them back. So the full code now looks like this:</p>
<blockquote><pre>$tweet = preg_replace("/(\s)/", "  ", $tweet);
$tweet = preg_replace_callback(
	'/(^|\s)#([\w\pL]{1,})(\W)/u'
	, create_function(
		'$matches'
		, 'return aktt_hashtag_link($matches[2], \' #\', \'\');'
	)
	, $tweet
);
$tweet = preg_replace("/(\s\s)/", " ", $tweet);</pre>
</blockquote>
<p>The only problem left now is that if you have a tag with a dash, it will remove the dash. So instead of &#8220;#åsa-nisse&#8221; with a link on &#8220;åsa&#8221;, like Twitter does. It outputs &#8220;#åsa nisse&#8221; with a link on &#8220;åsa&#8221;. Like this:</p>
<p><img src="http://www.feedmeastraycat.net/uploads//tweet2.png" alt="" title="Fixed Tweet" width="211" height="102" class="alignnone size-full wp-image-6099" style="margin-bottom: 5px;" /><br/><small>All tags are found, but the dash is missing from &#8220;åsa-nisse&#8221;.</small></p>
<p>Now I just hope that the guys over at <a href="http://crowdfavorite.com/">Crows Favorite</a> sees my e-mail and fixes this in the official release. Hopefully with an even nicer solution.</p>
<p>By the way&#8230;</p>
<p>To fix this hack, from home, on a Saturday, I finally bought <a href="http://www.panic.com/coda/">Coda</a> in the Mac App Store. It&#8217;s a bit expensive. I&#8217;m using Eclipse at work, which is free and has more features. I really miss the autocomplete features. But for quick hacks on Saturdays, Coda is really nice. Eclipse is bloaty and slow. I hope I can find some good plugins for autocomplete or that Panic can add it. I would love to be able to Switch. Coda feels more like Xcode 4. I would love to be able to do all my work in Xcode 4. But since I code PHP and not Objective-C at work &#8230; Well. Let&#8217;s give Panic some money by buying Coda and hope for the best! /rant</p>
<p>Time to go and give my Emma some cuddle before she gets totally bored out of her mind. Peace.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.feedmeastraycat.net/2011/05/28/umlauts-in-hash-tags-in-twitter-tools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hello, World!</title>
		<link>http://www.feedmeastraycat.net/2008/11/28/hello-world/</link>
		<comments>http://www.feedmeastraycat.net/2008/11/28/hello-world/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 21:33:04 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Swedish]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone Simulator]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://www.feedmeastraycat.net/?p=1269</guid>
		<description><![CDATA[Jag leker iPhone-utvecklare. Fast jag har ju ingen iPhone då &#8230; Men som tur är så finns ju iPhone Simulator.]]></description>
			<content:encoded><![CDATA[<p>Jag leker iPhone-utvecklare. Fast jag har ju ingen iPhone då &#8230; Men som tur är så finns ju iPhone Simulator.</p>
<div style="padding: 10px; text-align: center;">
<img src="http://www.feedmeastraycat.net/uploads//helloworld.gif" alt="" title="Hello iPhone" width="250" height="440" class="alignnone size-full wp-image-1270" />
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.feedmeastraycat.net/2008/11/28/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

