Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 988
Anton Petrunin Avatar asked Aug 31 '18 17:08

Anton Petrunin


People also ask

What encoding does GitHub use?

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.

How do you guess the encoding of a document?

Open up your file using regular old vanilla Notepad that comes with Windows. It will show you the encoding of the file when you click "Save As...". Whatever the default-selected encoding is, that is what your current encoding is for the file.

What is the encoding of a file?

An encoding standard is a numbering scheme that assigns each text character in a character set to a numeric value. A character set can include alphabetical characters, numbers, and other symbols.

How do I read a file in GitHub?

On GitHub.com, navigate to the main page of the repository. Click to open the file whose line history you want to view.


1 Answers

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).

like image 50
creyD Avatar answered Sep 28 '22 10:09

creyD