Fixed "invalid byte sequence in UTF-8"

regarding
https://bugs.ruby-lang.org/issues/6190