UNI code(UTF-8)混帐的bash [英] Unicode (utf-8) with git-bash

查看:174
本文介绍了UNI code(UTF-8)混帐的bash的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些麻烦UNI code为混帐bash的工作(在Windows 7)。我已经尝试了很多事情没有成功。虽然我不太知道什么是负责为这个,所以我可能会在错误的方向上努力。

I'm having some trouble getting unicode to work for git-bash (on windows 7). I have tried many things without success. Although, I'm not quite sure what is responsible to for this so i might be working in the wrong direction.

这真的好像这应该是可能为cmd.exe的编码可以改为单向code。与'CHCP 65001。

It really seems this should be possible as the encoding for cmd.exe can be changed to unicode with 'chcp 65001'.

这里有一些事情我已经试过(除了明显的通过图形用户界面的配置选项看)。

Here are some things I've tried (besides the obvious of looking through the configuration options in the GUI).


  1. 在'.bashrc'中设置环境变量。我想这是有道理的,这并不工作,因为我认为这是一个Linux的事情。在区域设置命令不存在。

  1. Setting environment variables in '.bashrc'. I guess it makes sense this doesn't work since i think it's a linux thing. The 'locale' command does not exist.

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8


  • 在cmd.exe的起步,改变编码UNI code。与'CHCP 65001,然后启动混帐的bash。这将导致试图猫我的UNI code测试文件时,我得到一个权限被拒绝。然而,catting一个文件,而不单code的作品就好。作为证明,我又滑落到cmd.exe的仍然可以猫的文件。使用我的默认编码(437)我可以猫在bash的文件(没有拒绝的权限,但输出捏造)。

  • Starting out in cmd.exe, changing the encoding to unicode with 'chcp 65001' and then starting up git-bash. This causes me to get a permission denied when trying to cat my unicode test file. However, catting a file without unicode works just fine. As demonstrated, dropping back out to cmd.exe i can still "cat" the file. Using my default encoding (437) i can cat the file in bash (no permission denied but the output is fudged).

    S:\>chcp 65001
    Active code page: 65001
    S:\>"C:\Program Files (x86)\Git\bin\sh.exe" --login -i
    zarac@TOWELIE /z
    cat /s/unicode.txt
    cat: write error: Permission denied
    zarac@TOWELIE /z
    cat /s/nounicode.txt
    abc
    zarac@TOWELIE /z
    L /s/unicode.txt
    -rw-r--r--    1 zarac    Administ        7 May 18 10:30 /s/unicode.txt
    zarac@TOWELIE /z
    whoami
    towelie\zarac
    zarac@TOWELIE /z
    exit
    Z:\>type S:\unicode.txt
    abc£
    


  • 使用/ U标志启动shell时(是有道理的,这是行不通的,因为它并不完全是因为如果 - 我理解,正确的,但它与UNI code做所以我尝试了)。

  • Using the /U flag when starting the shell (makes sense that it doesn't work because it's not quite what it's for if-i-understand-correctly, but it has to do with unicode so i tried it).

    C:\Windows\SysWOW64\cmd.exe /U /C "C:\Program Files (x86)\Git\bin\sh.exe" --login -i
    


  • 正如我preFER使用Console2,我已经尝试添加一个DWORD值命名为codePAGE与值65001(十进制)根据[HKEY_CURRENT_USER \\控制台] Windows注册表以及[ HKEY_CURRENT_USER \\控制台\\混帐]猛砸。这似乎也为制定CHCP 65001的效果相同接受它的自动。 (http://stackoverflow.com/questions/379240/is-there-a-windows-command-shell-that-will-display-uni$c$c-characters)

  • As I prefer to use Console2, I've tried adding a dword value named CodePage with the value 65001 (decimal) to the windows registry under [HKEY_CURRENT_USER\Console] as well as [HKEY_CURRENT_USER\Console\Git Bash]. This seems to have the same effect as setting 'chcp 65001' accept that it's "automatic". (http://stackoverflow.com/questions/379240/is-there-a-windows-command-shell-that-will-display-unicode-characters)

    JPSoft的TCC / LE

    JPSoft's TCC/LE

    PowerCMD

    计算器

    duckduckgo

    duckduckgo

    Ixquick的/谷歌

    ixquick / google

    所以,方法2似乎可行如果权限问题可以修复的。不过,我接受pretty很多的任何解决方案,虽然我preFER如果我可以使用Console2(主要是因为它的漂亮的标签功能)。也许有解决办法是建立一个SSH服务器,然后使用腻子/小鹰连接到它,但是这只是错了! ; )

    So, method 2 seems viable if that permission issue can be fixed. However, I'm open to pretty much any solution although i prefer if i can use Console2 (due mostly to it's nifty tab feature). Perhaps one solution would be to setup an SSH server and then use Putty/Kitty to connect to it, but that's just wrong! ; )

    PS。是否有混帐bash的任何官方文件?

    PS. Is there any official documentation for git-bash?

    推荐答案

    作为CharlesB在评论中说,msysgit 1.7.10处理单code正确。仍然有一些问题,但我可以证实,更新也解决我遇到的问题。

    As CharlesB said in a comment, msysgit 1.7.10 handles unicode correctly. There are still a few issues but I can confirm that updating did solve the issue I was having.

    请参阅:<一href=\"https://github.com/msysgit/msysgit/wiki/Git-for-Windows-Uni$c$c-Support\">https://github.com/msysgit/msysgit/wiki/Git-for-Windows-Uni$c$c-Support

    这篇关于UNI code(UTF-8)混帐的bash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆