As David puts it, after almost eight months Rails 1.2 RC1 is out
We have been reading and playing for some time with the new features such us “REST and Resources” as well as “Formats and respond_to”. Since Ruby won’t be multibyte-aware until this time next year, what was really new to me is “Multibyte”:
Imagine the string ‘€2.99’. If we manipulate it at a byte-level, it’s easy to get broken dreams:
‘€2.99’[0,1] # => ”\342”
‘€2.99’[0,2] # => ”?”
‘€2.99’[0,3] # => “€”
The € character takes three bytes. So not only can’t you easily byte-manipulate it, but String#first and TextHelper#truncate used to choke too. In the old days, this would happen:
‘€2.99’.first # => ’\342’
truncate(‘€2.99’, 2) # => ’?’
With Rails 1.2, you of course get:
‘€2.99’.first # => ‘€’
truncate(‘€2.99’, 2) # => ‘€2’







No comments yet.
Leave a comment