Cygwin command not found bad characters found in .bashrc 357\273\277

前端 未结 6 888
一生所求
一生所求 2021-01-05 16:42

I\'m new to Cygwin, I just installed it and attempted to set some simple environment variables. However, when I open the command shell, I get the error \"#357\\273\\277 com

相关标签:
6条回答
  • 2021-01-05 16:58

    Since you have edited your .bashrc outside of Cygwin and used a Windows editor, the editor might have messed up your newline character (ie. CR, R, etc.) You can tell Notepad++ to show hidden characters. I think you can find it in its settings. Changing charsets is one thing, but being able to see hidden characters is another.

    0 讨论(0)
  • 2021-01-05 17:01

    This article mentions a few programs that you can use to convert text files from one standard to another. Try using dos2unix on the file (in the cygwin command line).

    0 讨论(0)
  • 2021-01-05 17:03

    It looks like if I change the encoding from UTF-8 to ANSI (not the view preferences), the file will update and the special characters are gone, fixing the "\357\273\277 command not found" issue. Hooray!

    0 讨论(0)
  • 2021-01-05 17:17

    One way to strip these is in Linux is by using vi. If you say

    vi filename

    and then in vi use the ed command :se fileencoding=ASCII

    this will strip the oddball characters out.

    You can confirm this by saving the file and then running od -c on the file.

    Before: od -c changes.sql | head 0000000 357 273 277 I N S E R T I N T O `

    After: od -c changes.sql | head 0000000 I N S E R T I N T O ` c o n

    0 讨论(0)
  • 2021-01-05 17:21

    Before feeding your files to cygwin bash, you can do a dos2unix conversion first to take care possible conflicts like CR LF. Open bash

    name@host ~ $ dos2unix your_file.sh

    0 讨论(0)
  • 2021-01-05 17:23

    As far as I know, a common problem with files saved in Notepad++ as UTF-8 and Cygwin is that Notepad++ saves UTF-8 encoded files with a byte order mark by default. This BOM character is not quite compatible with unix-like environments like Cygwin.

    If you need unicode characters in these files, then you can try using the "UTF-8 without BOM" encoding in Notepad++, otherwise you can use ANSI or other encodings that don't use a BOM by default.

    Besides the encoding, make sure the file's saved with unix (LF) line-breaks.

    0 讨论(0)
提交回复
热议问题