Ensure proper file encoding and remove unnecessary requires

See https://github.com/rails/rails/issues/9498.