Personal Intro (For frequent visitors of this blog only)
Yes, I’m checking out Rails. Mainly to see what ASP.NET MVC is missing. Very initial impressions, A Lot!
Anyway, this post is intended to be found by new visitors who already know a little Ruby, so, no introductions for this time. Maybe a different post.
Just to set expectations, there are only 2 lines needed for getting it to work. This post is just to encourage myself to keep writing…
Example
So, let’s assume a simple website that ha a single controller “Say” with only one Action “Hello”.
class SayController < ApplicationController def hello @name = "محمد" end end
The first time you try to add an Arabic word to any Ruby string, you’ll get the error:v
invalid multibyte char (US-ASCII)
syntax error, unexpected $end, expecting keyword_end
@name = "محمد"
To fix this, you need to tell Ruby that this file is written in Unicode.
This is done by adding the underlined text as the “first” line in the file:
# encoding: utf-8class SayController < ApplicationController def hello @name = "محمد" end end
CV Download (.docx)
Google Reader Shared Items
LinkedIn Recommendations
Twitter Updates