Reputation: 185
I have been trying to create my own mods for The Witcher 3: Wild Hunt in its proprietary scripting language, Witcher Script, which has .ws
extension.
I have created a Git repo to track these changes, and I have updated both .gitattribute
and .git/config
files so that I can see git diff
results on CLI:
.gitattribute
:*.ws text
*.ws diff=localizablestrings
.git/config
:[diff "localizablestrings"]
textconv = "iconv -f utf-16 -t utf-8"
However, when I reach my repo on GitHub and try to see the changes I've done, I get this:
Is there any setting on GitHub that I have to update so that GitHub can show the commit changes as text?
Upvotes: 1
Views: 1275
Reputation: 76409
As Joachim Sauer mentioned in the comments, this isn't possible. A file in UTF-16 is considered binary because it almost certainly contains NUL bytes. Part of the reason is because GitHub needs to actually render the diff, and things that aren't valid UTF-8 can't be rendered as-is in the page.
Note that the textconv commands are loaded into your config and not the repo, and as such, nobody else even has a copy of them. That's because running commands automatically based on the repository would be a colossal security risk, since someone could easily execute arbitrary code based on a malicious command.
If these files are really text files, just in UTF-16, consider instead storing them in UTF-8 and checking them out into the repository as UTF-16. You can do this with something like one of the following:
*.ws text working-tree-encoding=UTF-16
# If you need the non-standard variant that's always LE with BOM:
*.ws text working-tree-encoding=UTF-16LE-BOM
Note that if you need the line endings to be CRLF, you can add eol=crlf
as well.
If you do that, then run git add --renormalize .
, then things should render properly in GitHub.
Upvotes: 7