On Feb 14, 2007, at 12:05 PM, Phrogz wrote: > On Feb 14, 8:51 am, Ian Macdonald <i... / caliban.org> wrote: >> On Wed 14 Feb 2007 at 23:42:10 +0900, Ian Macdonald wrote: >> >>> On Wed 14 Feb 2007 at 18:00:22 +0900, Robert Klemme wrote: >> >>>> Another idea: maybe the readline lib interferes with encodings >>>> somehow >>>> in IRB? What happens if you invoke your script from within IRB >>>> via "load"? >> >>> It runs as if run from the command line: >> >>> irb(main):001:0> load 'foo' >>> 2 >>> 2 >> >> I beg your pardon. I must have had the locale set incorrectly on that >> run. It runs as if typed interactively into irb: >> >> $ irb >> irb(main):001:0> load 'foo' >> nil >> 2 > > Phewsh. Combined with the behavior you reported for loading a global > and then matching in IRB, I had feared the world had gone insane. At > least its consistently weird and the regexp match is, in fact, the > culprit. Why don't you just find out which characters are in the [:alnum:] and \w sets? >> alnums = (0..0377).select {|c| c.chr =~ /[[:alnum:]]/ }.map {|c| c.chr}.join => "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" >> dubyas = (0..0377).select {|c| c.chr =~ /\w/ }.map {|c|c.chr}.join => "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" $ LANG=nl_NL irb >> alnums = (0..0377).select {|c| c.chr =~ /[[:alnum:]]/ }.map {|c| c.chr}.join => "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\252 \265\272\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316 \317\320\321\322\323\324\325\326\330\331\332\333\334\335\336\337\340 \341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361 \362\363\364\365\366\370\371\372\373\374\375\376\377" >> dubyas = (0..0377).select {|c| c.chr =~ /\w/ }.map {|c|c.chr}.join => "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" sheesh! -Rob Rob Biedenharn http://agileconsultingllc.com Rob / AgileConsultingLLC.com