When running a program with # encoding: utf-8 on a linux machine with UTF-8 encoding and a PostgreSQL database with UTF-8 encoding, I get the error message bytea.rb:11: invalid multibyte escape: /[\000-\037\047\134\177-\377]/ (SyntaxError).
Adding # encoding: US-ASCII just to the file bytea.rb will solve the problem!