Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

ruby on rails - rails4 unknown encoding name - CP720

I got now this error When I want to run any gem commands such as

 gem install rubygems-update

the error

while executing gem ... (ArgumentError)
unknown encoding name - CP720

so when I goggled it I found some one suggest to use this commands to Change encoding to 1252

C:DevKit> chcp 1252
c:DevKit> ruby dk.rb init  

but after I used it I still got the same error , so how i can solve this issue ?????

Note : I'm using windows 7

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This command fixed it for me (without the second command);

chcp 1252

This changes the code page of the current terminal.

UPDATE; why this happens?

From some other resources, this is caused by your current terminal as it is using a codepage (encoding) that is not supported by Ruby. Codepage 720 is Arabic characters used by MS-DOS back in the day, and seems Ruby do not have a translation table for it.

I recommend you switch your terminal codepage to something Ruby understands, like the windows 1252 character encoding of the Latin alphabet..

That will change the codepage only for this terminal. If you want to make the change permanent, you have to edit the Regedit as explained in this article but be aware this can cause your machine not to boot up!

A safer way for permanently force the terminal to use the right code page is by using a batch as explained here.

If you are using nodejs and interested on the "nodevars.bat" I'm currently using, then check this post.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...