Skip to content

gsub encoding error when running on Linux Docker Container Invalid byte sequence in US-ASCII

I have a string I’m converting from "rn" to "n" line ends using:

input.gsub(/rn?/, "n")

When I run it on my Windows host, it works fine. When I run on my Linux host, in a docker container, I get this error:

in `gsub': invalid byte sequence in US-ASCII (ArgumentError)

I am running Ruby 2.2.



I fixed it by doing this Invalid byte sequence in UTF-8 (ArgumentError)

User contributions licensed under: CC BY-SA
8 People found this is helpful