Fix encoding issue for Ruby > 1.9