Try to get the encoding to see if the problem fixes:
your_string.force_encoding(::Encoding::UTF_8)
If so, immerse yourself in your application and indicate that it sets the wrong encoding, where and why.
Perhaps the server / webpage, like the page you serve, is displayed as US-ASCII because of the header. Or the server starts with encoding other than UTF-8. Or something else in this regard. Your script ends with a piece of external data that is not UTF-8.
Denis de bernardy
source share