Thanks for all your responses.

> 
> I think regexp is the wrong way to do this.  Since this is a binary
> file format a regexp is unlikely to give you real data.  Scanning
> seems to work out better.  Where did you get this data?
> 

Im confused about binary file format. Is UTF-8 and binary file format 
two seperate things? I thought binary was just represented by unicode?

Why would the regexp trip up at the binary part if i tell it the 
encoding is UTF-8?

Also with read() isnt that dangerous with Unicode text? Can I assume 
that all characters are only 1 byte wide?

The file is bencoded (i think its like yaml in some respects).

-- 
Posted via http://www.ruby-forum.com/.