From: Brian Candler Date: 2010-09-08T21:02:56+09:00 Subject: Re: Regex breaks when string contains binary data Aisha Fenton wrote: > $KCODE is set to "UTF8", and my RUBYOPT env variable is set to > "rubygems". Try writing your script like this: #!/usr/bin/ruby -Kn puts "\345HI".match(/HI|BYE/).inspect or put $KCODE="NONE" at the top. If it's not being set in RUBYOPT then perhaps Apple built ruby using option --with-default-kcode=UTF8 > Hmmm could be the problem. I haven't really got my head around Ruby's > String encoding, might be time. ruby 1.8's is pretty straightforward; ruby 1.9's is just boggling. http://blog.grayproductions.net/categories/character_encodings http://github.com/candlerb/string19/ Regards, Brian. -- Posted via http://www.ruby-forum.com/.