Anton Petrunin
Anton Petrunin

Reputation: 198

How does GitHub guess the encoding of a file?

How GitHub guesses encoding of a text file?

I have two text files in my repository: README.ru.koi8-r and mpman-ru.tex, both use encoding koi8-r. GitHub uses right encoding for the first one and uses wrong for the second one.

Maybe there is a trick to force right guess?

Postscript. I solved the problem by adding a long comment at the top of the file in koi8-r, but there should be a better way to do it.

Upvotes: 12

Views: 4571

Answers (2)

creyD
creyD

Reputation: 2126

In the GitHub documentation it is stated that you in fact should "determine encoding for every single file". Furthermore they say that "(...) encoding could be set in .gitattributes file." which is probably what you are looking for right now as this will be pushable to GitHub (documentation for gitattributes files on git-scm).

Upvotes: 2

MrMartin
MrMartin

Reputation: 467

You set the encoding for a repository with

git config gui.encoding koi8-r

Upvotes: 0

Related Questions