<?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>tarsolya</title>
	<atom:link href="http://tarsolya.xpnindustries.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tarsolya.xpnindustries.com</link>
	<description>Morog a farkas.</description>
	<lastBuildDate>Mon, 06 Apr 2009 09:09:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Making Passenger play nice with your environment encodings</title>
		<link>http://tarsolya.xpnindustries.com/2009/04/making-passenger-play-nice-with-your-environment-encodings/</link>
		<comments>http://tarsolya.xpnindustries.com/2009/04/making-passenger-play-nice-with-your-environment-encodings/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 08:57:51 +0000</pubDate>
		<dc:creator>tarsolya</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[haml]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby 1.9]]></category>

		<guid isPermaLink="false">http://tarsolya.xpnindustries.com/?p=8</guid>
		<description><![CDATA[I had a rather long session of investigation on the last weekend. I was fiddling around with a new Ruby 1.9 app and the nightmare what&#8217;s called &#8220;compat issues&#8221;. Almost all of them were caused by Ruby&#8217;s brand new encoding handling. One by one, I solved all of them, but one elusive son of a [...]]]></description>
			<content:encoded><![CDATA[<p>I had a rather long session of investigation on the last weekend. I was fiddling around with a new Ruby 1.9 app and the nightmare what&#8217;s called &#8220;compat issues&#8221;. Almost all of them were caused by Ruby&#8217;s brand new encoding handling. One by one, I solved all of them, but one elusive son of a bug kept coming back.</p>
<p>It was <em>&#8220;INVALID BYTE SEQUENCE IN US-ASCII&#8221;</em>, it only happened when multibyte characters were present in the Haml template. Traces were pointing to engine.rb, a line where a regexp match took place. Checking the involved variables revealed that the template&#8217;s source had <code>US-ASCII</code> encoding which is the last fallback default, if no other encoding could be derived from the environment or set explicitly somewhere in the code. Haml raised because it tried to match against a single byte encoding and it encountered multibyte characters instead.</p>
<p>After some investigation, it was clear that Apache did not pick up the proper environment variables for ruby when they were launched by Passenger&#8217;s application spawner, nor these variables could be set by<code>SetEnv</code> and/or <code>PassEnv</code> directives.</p>
<p>Altough on OSX Leopard there is a way to set the above variables, so that the spawned ruby processes will pick them up properly, but it&#8217;s kinda hacky: you have to edit Apache&#8217;s <em>lauchd jobfile</em> file, which by default resides at <code>/System/Library/LaunchDaemons/org.apache.httpd.plist</code>, and add something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>EnvironmentVariables<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>LANG<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>hu_HU.UTF-8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>LC_CTYPE<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>hu_HU.UTF-8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Now after an Apace restart ruby processes spawned by Passenger should properly report external encoding.</p>
<p>The detailed story and some followup <a href="http://code.google.com/p/phusion-passenger/issues/detail?id=233">is here</a> on the <a href="http://www.modrails.com/">Phusion Passenger</a> issue tracker, if you are interested.</p>
]]></content:encoded>
			<wfw:commentRss>http://tarsolya.xpnindustries.com/2009/04/making-passenger-play-nice-with-your-environment-encodings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nem csak a kód &#8230;</title>
		<link>http://tarsolya.xpnindustries.com/2009/02/nem-csak-a-kod/</link>
		<comments>http://tarsolya.xpnindustries.com/2009/02/nem-csak-a-kod/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 11:02:59 +0000</pubDate>
		<dc:creator>tarsolya</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tarsolya.xpnindustries.com/?p=3</guid>
		<description><![CDATA[Nem csak a kód kap itt szerepet, de az is. Kéne blogolni, vagyis írhatnék az van, csak basz az ideg is meg minden.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Rails::Initializer.run do &#124;config&#124;
  # Settings in config/environments/* take precedence over those specified here.
  # Application configuration should go into files in config/initializers
  # -- all .rb files in that directory [...]]]></description>
			<content:encoded><![CDATA[<p>Nem csak a kód kap itt szerepet, de az is. Kéne blogolni, vagyis írhatnék az van, csak basz az ideg is meg minden.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">Rails::Initializer</span>.<span style="color:#9900CC;">run</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>config<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#008000; font-style:italic;"># Settings in config/environments/* take precedence over those specified here.</span>
  <span style="color:#008000; font-style:italic;"># Application configuration should go into files in config/initializers</span>
  <span style="color:#008000; font-style:italic;"># -- all .rb files in that directory are automatically loaded.</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Add additional load paths for your own custom dirs</span>
  <span style="color:#008000; font-style:italic;"># config.load_paths += %W( #{RAILS_ROOT}/extras )</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Specify gems that this application depends on and have them installed with rake gems:install</span>
  <span style="color:#008000; font-style:italic;"># config.gem &quot;bj&quot;</span>
  config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">'thoughtbot-clearance'</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'clearance'</span>, <span style="color:#ff3333; font-weight:bold;">:source</span>  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'http://gems.github.com'</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'&gt;= 0.4.7'</span>
  config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">'thoughtbot-shoulda'</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'shoulda'</span>, <span style="color:#ff3333; font-weight:bold;">:source</span>  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;http://gems.github.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'&gt;= 2.9.1'</span>
  config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">'thoughtbot-factory_girl'</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'factory_girl'</span>, <span style="color:#ff3333; font-weight:bold;">:source</span>  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;http://gems.github.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'&gt;= 1.1.5'</span>
  config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">'configatron'</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'configatron'</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'&gt;= 2.2'</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://tarsolya.xpnindustries.com/2009/02/nem-csak-a-kod/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
