Cygwin supports Chinese configuration

  
 

Cygwin is an excellent software for simulating Linux environment under Windows!

By default, most of cygwin's commands do not support Chinese, such as ls, the display is a question mark

but we can modify it to support Chinese
>

First, go to the user's home directory

$cd ~

and find .inputrc, if not, create a new

example:

1. Add the following code at the end of cygwin/home/[user]/.bash_profile

alias ls=’ls –color –show-control-chars’

export LC_ALL= zh_CN.GB23122

export LC_CTYPE=zh_CN.GB2312

export LANG=zh_CN.GB2312

export XMODIFIERS="@im=Chinput"3

Stty cs8 -istrip

stty pass8

export LESSCHARSET=latin1

2. Modify the code in cygwin/home/[user]/.inputrc and remove the relevant comments.

set meta-flag on

set convert-meta off

set output-meta on

set input-meta on

3. Add

at the end of cygwin/home/[user]/.bashrc. The above steps solve the problem of garbled Chinese input in cygwin.

Online A lot of solutions, set the environment to zh_CN.GB23122, but I tried it or not, and then set en_US.UTF-8, nano can edit the text, but save the file name is Chinese but not, finally en_US.UTF- 16 is OK, but there is still a problem I don't understand, export LESSCHARSET=latin1 I don't know what it means, who can tell me.

If you change the path of the home, please refer to the following method:

If the HOME directory changes, you need to edit cygwin.bat

Add the set HOME= before the bash command. C:\\cygwin\\home

$ more cygwin.bat

@echo off

C:

chdir C:\\cygwin\\bin

set HOME=C:\\cygwin\\home

bash –login -i

aaronvox#aaronvox ~

$ pwd

/home

The configuration file after this operation might be:

aaronvox#aaronvox ~

$ ls -a

. .. .bash_profile .bashrc .inputc .inputrc

aaronvox#aaronvox ~

$ more .inputc

set meta-flag on

set convert-meta o

Set output-meta on

set input-meta on

aaronvox#aaronvox ~

$ more .bash_profile

# base-files version 3.4-2

# WARNING

#

# IF THIS .bash_profile IS MODIFIED IT WILL NOT BE UPDATED BY THE CYGWIN

# SETUP PROGRAM. IT BECOMES YOUR RESPONSIBILITY .

#

# The latest version as installed by the Cygwin Setup program can

# always Be found at /etc/defaults/etc/skel/.bash_profile

# ~/.bash_profile: executed by bash for login shells.

# source the system wide bashrc if it exists

if [ -e /etc/bash.bashrc ] ; then

source /etc/bash.bashrc

fi

# source the users bashrc if it Owner

if [ -e "${HOME}/.bashrc" ] ; then

source "${HOME}/.bashrc"

fi

# Set PATH so it includes user’s private bin if it exists

# if [ -d "${HOME}/bin" ] ; then

# PATH= ${HOME}/bin:${PATH}

# fi

# Set MANPATH so it includes users’ private man if it exists

# if [ -d " ;${HOME}/man" ]; then

# MANPATH=${HOME}/man:${MANPATH}

# fi

# Set INFOPATH so it Includes users’ private info if it exists

# if [ -d "${HOME}/info" ]; then

# INFOPATH=${HOME}/info:${INFOPATH }

# fi

Since you have made the above changes, you can support Chinese!

Copyright © Windows knowledge All Rights Reserved