Fixed output encoding issues

If the console outputs UTF-8 chars, the match method for regular expressions would raise the error: invalid byte sequence in US-ASCII (ArgumentError).
This will fix that.