ruby Error

Resolving "invalid byte sequence in Windows-31J (ArgumentError)" Error #Ruby

This article introduces the solution for the "===': invalid byte sequence in Windows-31J (ArgumentError)" error in the Ruby programming language. It should be resolved by one of the following methods. Add the following to the file. Encoding.default_external =...

Shou Arisaka
1 min read
Oct 19, 2025

This article introduces the solution for the " ===': invalid byte sequence in Windows-31J (ArgumentError)" error in the Ruby programming language.

It should be resolved by one of the following methods.

Add the following to the file.

Encoding.default_external = 'UTF-8'

Or add the following.

File.open(file, "r:utf-8") do |f|

Or specify options during execution.

$ ruby -Eutf-8 foo.rb

Share this article

Shou Arisaka Oct 19, 2025

๐Ÿ”— Copy Links