From: Richard Conroy Date: 2011-01-11T02:09:20+09:00 Subject: Re: Japanese / chinese characters --0016367d67404e761304998107f9 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Yeah, that is one way of doing it. With respect to the speed issue, the range boundaries that define the han characters (or any character range for that matter) have significance at the bit level. You could use bit algorithms for speed (though it is possible that in Ruby you would not achieve the desired speed increase that you might get with C or Java. You might also want to look into specifying unicode ranges in your regexes. I remember that the Java regular expression library had shortcuts for specifying localised characters (like Han characters). I dont think the Ruby regex API has these shortcuts, but in the end it is just a unicode range. On Mon, Jan 10, 2011 at 4:53 PM, Luis G. wrote: > I found out this: > > irb(main):003:0> p "裏字幕組".unpack("U*") > [35023, 23383, 24149, 32068] > > So, I can unpack it and check if is between the range you talked about, > right? If so, now I just need to find the range for the chinese and > japanese characters... > > Isn't this an heavy operation? I have lots of sentences to test, with > size not bigger that 512 characters. > > -- > Posted via http://www.ruby-forum.com/. > -- http://richardconroy.blogspot.com | http://twitter.com/RichardConroy --0016367d67404e761304998107f9--