On Mon, 15 Sep 2008 18:08:14 +1000, Tanaka Akira <akr / fsij.org> wrote:

> In article <48cddb5533ad_8725cd9524342 / redmine.ruby-lang.org>,
>   Michael Selig <redmine / ruby-lang.org> writes:
>
>> UTF-16 & UTF-32 (and maybe other non-ascii compatible encodings) don't  
>> seem to be work as Regexp patterns.
>>
>> Regexp.new("abc".encode("UTF-16BE"))
>> ==> EncodingCompatibilityError: incompatible character encodings:  
>> US-ASCII and UTF-16BE
>
> % ruby -ve 'p Regexp.new("abc".encode("UTF-16BE")) =~  
> "abc".encode("UTF-16BE")'
> ruby 1.9.0 (2008-09-15 revision 19356) [i686-linux]
> 0

I see, I have diagnosed the problem wrongly. I was using irb.

ruby -ve 'p Regexp.new("abc".encode("UTF-16BE"))'
ruby 1.9.0 (2008-09-03 revision 19073) [i686-linux]
-e:1:in `p': incompatible character encodings: UTF-16BE and ASCII-8BIT  
(EncodingCompatibilityError)
	from -e:1:in `<main>'

This is the error I was getting in irb, and I mistakenly assumed it was  
 from the Regexp::new.
It is a different problem - not as bad as I thought!

Thanks
Mike