How to deal with character code errors when building ruby's environment in Windows 10

Asked 2 years ago, Updated 2 years ago, 39 views

I am currently trying to build ruby's environment using Windows 10, but I have followed the steps below to find a character code related error, so I have a question.

Installation in the following order

ruby3.0.0
node.js
yarn
sqlite3
rails 6.1.3

After doing rails new app and moving to the directory, I ran rails webpacker:install, but the following error occurred:

Ruby30-x64/lib/ruby/3.0.0/pathname.rb:50:in match?:invalid byte sequence in outf-8 (ArgumentError)

As a workaround, I tried the following code in cmd, but it didn't work.

Encoding.default_external='UTF-8'

Other than that, I checked if the version of Windows 10 I am using is different from the version of ruby I installed, but it was different because it was correct.
If anyone knows, please let me know.

ruby-on-rails ruby windows

2022-09-30 19:50

1 Answers

The Japanese version of Windows uses the so-called CP932 character code, and if the user name is in Japanese, inconsistencies occur and errors occur.
The workaround is to check "Use Unicode UTF-8 with Worldwide Language Support" under "Change System Locale" in the System Configuration Regional dialog.
However, I do not recommend it because the Japanese app on Windows is garbled.

The next best option is to build your environment with Ububtu on WSL2 (Windows Subsystem for Linux) and so on.


2022-09-30 19:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.