fixes regex encoding bug in ruby 2