From: Brian Candler Date: 2012-04-18T07:39:34+09:00 Subject: Re: Capital Cyrillic letter in Ruby class name (UTF-8) Bartosz DziewoƄski wrote in post #1057002: > Vladimir, unfortunately Unicode and internationalisation in general is > hard. In C code (that's what Ruby is written in), checking whether a > letter is an ASCII capital one is dead simple. Checking whether is it > an Unicode capital requires decoding it from whichever variant of UTF > is was encoded in and looking it up in one oh huge tables defining > various letter properties to check if it is a capital or not. You > would probably have to change parsing rules and a lot of internal code > to make it possible, since capital first letter is the only difference > between Ruby constant or variable. Please note that the above is untrue. ruby 1.9 already does have the functions built-in to determine whether a letter is Unicode capital or not; however it explicitly only accepts ASCII upper-case for the start of constants. This was a conscious design decision. See http://redmine.ruby-lang.org/issues/show/1853 and the other threads linked from that Redmine issue. If you wanted to allow Unicode capitals as the start of constants, it would be a very simple patch to the C source. What I've managed to gather about upper/lower case handing in ruby 1.9 is documented at https://github.com/candlerb/string19/blob/master/string19.rb (section 11) Regards, Brian. P.S. I'm not saying I think this is a good design decision - in fact I think the whole encoding aspect of ruby 1.9 is a dog's breakfast - but that's purely my opinion. -- Posted via http://www.ruby-forum.com/.