Rails4 Unknown Encoding Name - Cp720

rails4 unknown encoding name - CP720

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.

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

When did you do

chcp 1252

did you get

Active code page: 1252

as a confirmation?

If not then maybe you are not using one of the windows command prompts like the default one or the node.js command prompt.. Because this won't work on the Git command prompt (MINGW32).

After you get the confirmation of changing the code page, you can execute gem commands without the annoying unknown encoding name error.

SASS installation issue with ruby

This is caused by your current terminal as it is using a codepage (encoding) that is not supported by Ruby, as Codepage 720 is related with Arabic characters as given here

so there are two possible solutions

  • change the default system language and restart.
  • run command chcp 1252if you don't want to change default language
    also check that solution as well.

Gem install error (sass compass)

Open up a command prompt and type:

chcp 1252

Then run the installer again:

gem install sass

Unfortunately there's a known issue in some versions of Ruby regarding this. See here

Obtain the name of a unknown process, by the window handle?

I don't know Ruby, but since you are invoking the WinAPI directly anyway, I can give you an example in C. Assuming you already have a HWND called hWnd scoped (error handling omitted for brevity):

HANDLE hProcess;
DWORD dwPID;
WCHAR lpFilename[MAX_PATH];

GetWindowThreadProcessId(hWnd, &dwPID)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwPID);
GetModuleFileNameEx(hProcess, NULL, lpFilename, _countof(lpFilename));
CloseHandle(hProcess);


Related Topics



Leave a reply



Submit