From: Daniel DeLorme Date: 2006-09-21T09:01:12+09:00 Subject: Re: Unicode and Character Classes -- a bug? Richard Wiseman wrote: > puts "Pattern includes \"[x\xa3]\":" > text.scan(/^[x\xa3]?[A-Z]$/).each {|s| puts s } That is very weird indeed. It's normal that your example doesn't work, because \xa3 is NOT valid utf8. But I would've expected it to work if you used the correct utf8 sequence for "炭" ("\xc3\xba"), except it doesn't! $KCODE='u' => "u" text = "\xc3\xbaA\nB\n\xc3\xbaC\nxD\nE" => "炭A\nB\n炭C\nxD\nE" text.scan(/^[x炭]?[A-Z]$/) => ["炭A", "B", "炭C", "xD", "E"] text.scan(/^[x\xc3\xba]?[A-Z]$/) => ["B", "xD", "E"] WTF? Can anyone explain this?