I can't remember how I made Git GUI to display UTF-8 encoded differences correctly. Also I can't find the guide in search engines.

Now I need to do this at new workplace. Could you write down instructions?

OS: Windows 7

有帮助吗?

解决方案

# Global setting for all you repositories
> git config --global gui.encoding utf-8

# For one repository only
> git config gui.encoding utf-8

Or from the GUI window:

Edit -> Options... -> Default File Contents Encoding -> Change

and select "Unicode (UTF-8)"

In the Options, you'll see that there are two panel, the one on the right is for all repositories, the one on the left for the local repository.

其他提示

The file content encoding is clarified with Git 2.34 (Q4 2021):

See commit 1e93770, commit fd680bc (27 Aug 2021) by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit bfe37f3, 10 Sep 2021)

docs: use "character encoding" to refer to commit-object encoding

Signed-off-by: Jeff King

The word "encoding" can mean a lot of things (e.g., base64 or quoted-printable encoding in emails, HTML entities, URL encoding, and so on).

The documentation for i18n.commitEncoding and i18n.logOutputEncoding uses the phrase "character encoding" to make this more clear.

Let's use that phrase in other places to make it clear what kind of encoding we are talking about.

This patch covers the gui.encoding option, as well as the --encoding option for git-log, etc (in this latter case, I word-smithed the sentence a little at the same time).
That, coupled with the mention of iconv in the --encoding description, should make this more clear.

git config now includes in its man page:

Specifies the default character encoding to use for displaying of

So git config gui.encoding utf-8 refers to character encoding, a mean to represent a repertoire of characters by some kind of encoding system that assigns a number to each character for digital representation.
(As opposed to a MIME Content-Transfer-Encoding like base64).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top