设为首页收藏本站

就爱编程论坛

 找回密码
 注册

人人连接登陆

无需注册,直接登录

用新浪微博连接

一步搞定

QQ登录

只需一步,快速开始

查看: 1706|回复: 0
打印 上一主题 下一主题

TortoiseHg中文文件名乱码解决 [复制链接]

Rank: 9Rank: 9Rank: 9

  • TA的每日心情
    无聊
    2025-5-27 03:37:20
  • 签到天数: 366 天

    [LV.9]以坛为家II

    论坛先锋 学习至圣 荣誉成员 论坛元老 活跃之星 终极领袖

    我玩的应用:

    跳转到指定楼层
    楼主
    发表于 2012-4-27 11:47:30 |只看该作者 |正序浏览
    基础知识
    • Mercurial(HG)是一个分布式的版本控制系统(VCS)之一。 和GIT类似。
    • HG内建Windows资源管理器前端TortoiseHg是 http://tortoisehg.bitbucket.org/ 可供下载。
    • TortoiseHg 0.8或更高版本,中文已经得到一定支持,可是文件名依旧会乱码。
    乱码原因
    • 在文件名“\”可能被包括在内。
      • Windows使用“\”分割路径,而Unix是“/”
    • Windows和Linux环境与不同的编码环境
      • 这个就不必详述了
    三种解决办法
    win32mbcs
    • 可以解决路径分割符问题
    hg-fixutf8Cygwin的Mercurial
    • Cygwin的1.7文件名处理为UTF - 8。基于这个原因,Cygwin的版本的Linux和Mercurial可用于互操作。然而,TortoiseHg和图形用户界面不可用。
    比较表
    字码解决乱码多个操作系统图形用户界面
    默认GBK××
    win32mbcsGBK×
    hg-fixutf8使用UTF - 8
    Cygwin使用UTF - 8×
    Fixutf8安装方法
    • 运行 hg clone http://bitbucket.org/stefanrusek/hg-fixutf8。可以得到一个文件夹,
    • 将这个文件夹拷贝到你想拷贝的地方。我拷贝在C:\Program Files\TortoiseHg\hg-fixutf8
    • 在C:\Users\yankai (yankai是我的用户名)下有一个隐藏文件mercurial.ini,如果没有创建一个,在他后面添上[extensions]fixutf8 = C:\Program Files\TortoiseHg\hg-fixutf8\fixutf8.py
    ok,乱码问题应该已经解决了。


    ----------

    FixUtf8 Extension

    This extension is not distributed with  Mercurial.

    Author: Stefan Rusek

    Repository: https://bitbucket.org/stefanrusek/hg-fixutf8/

    This extension  appears to be incompatible with Mercurial 2.0 and later.

    Compatibility: requires Mercurial 1.1 or later and Python 2.5  or later

    This extension is still in beta, use it at  your own risk.

    Overview

    This extension corrects filename encoding problems on Windows.

    Windows internally stores all command line arguments and  filenames in Unicode UTF-16 (16-bit character strings), and for backward  compatibility with Windows 3.x, provides functions to retrieve them in  non-Unicode 8-bit character strings. Python 2.x and Mercurial call the  non-Unicode functions. This causes Mercurial to misbehave when used with  filenames that contain Unicode characters. This extension resolves this issue,  by making sure that the Unicode functions are called. Since Mercurial expects  8-bit character strings, the extension converts the strings to UTF-8 before  returning them to Mercurial.

    There is one case where FixUtf8 fails to add support for Unicode, because the  repository object for the current working directory is created before extensions  are loaded. There is nothing that FixUtf8 can do to fix the problem of a repository  residing within a
    directory with Unicode  characters in it. However, FixUtf8  does not have a problem with directories with Unicode characters inside
    of the repository.

    Ideally, you enable the extension before you need international  filenames, but if you already have international filenames in your repo, then  you need to fix your filenames.

    In order for Unicode characters to display properly, you should  change the Windows console font from "Raster Fonts" to "Lucida Console".

    Fixing existing filenames

    To fix your filenames simply do the following:




    >hg addremove -s 100
    >hg commit -m "Fix filenames"

    Configuration
    Configure your .hgrc to enable the extension by adding  following lines:





    [extensions]
    fixutf8 = path/to/fixutf8.py ------
    分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    分享分享0 收藏收藏0 支持支持0 反对反对0 分享到人人 转发到微博
    [img=http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=fRUcHhYWGAQ9GxIFEBwUEVMeEhA]http://rescdn.qqmail.com/zh_CN/htmledition/images/function/qm_open/ico_mailme_02.png[/img]

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册 人人连接登陆

    晴云孤魂's Blog|就爱编程搜帖|手机版|Archiver|就爱编程论坛     

    GMT+8, 2025-7-2 05:48 , Processed in 0.116381 second(s), 27 queries .

    Powered by Discuz! X2

    © 2001-2011 Comsenz Inc.

    回顶部