On Jan 10, 2011, at 1:22 PM, Caio Chassot wrote:

> On 2011-01-10, at 19:19 , Laurent Sansonetti wrote:
>> 
>> Assuming your array contains ASCII fixnum representation of characters, 
>> messaging #pack('c*') on it should give you a string object back.
>> 
>> I dislike this method, but here I don't see a better choice.
> 
> numbers = [65, 195, 169]
> s = numbers.map(&:chr).join
> 
> you may want to force the string to be treated as UTF-8.
> 
> s.force_encoding('UTF-8')

That's much better indeed!

Laurent
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to