Emmanuel Touzery wrote:

> b/ anyway it's a moot point, because ruby doesn't handle unicode strings.. at 
> least it's what I understood. am I wrong? Well, i read it should work, but 
> then from what I understood capitalize, size etc don't work. once more, if I 
> understood correctly, there are libaries for this (one is 0.1, one is 0.2 
> "may work").

Use the 'jcode' library, and set the encoding to unicode with the -K 
option (or by setting the KCODE variable). jcode overrides most of the 
methods in class String so that they support the encoding you set with 
the -K option. The exception is the length and size methods: it leaves 
these untouched and instead gives you two new methods, jlength and jsize:

   $KCODE = "u"
   require 'jcode'
   a = "x/y"
   puts a
   puts a.length
   puts a.jlength
   puts a.chop!
   puts a.chop!
   puts a.length
   puts a.jlength

generates

   x/y
   9
   5
   x/
   x/
   5
   3

(I don't know if this e-mail will encode the above properly. If not, the 
original string was "\xe2\x88\x82x/\xe2\x88\x82y", which is 
<delta>x/<delta>y.


Cheers


Dave