Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1145

Git failed to encode from UTF-8 to UTF-16LE-BOM

$
0
0

I have a lot of legacy Windows Resource Files (*.rc) in my repository. Initially they had UTF-8, ASCII, UTF-16 or other encoding. Also there were no .gitattributes in my repo, so git wasn't able to produce diff for UTF-16 files and treated them as binary.

In my dev branch I've converted all of *.rc files to UTF-16LE-BOM with CRLF line endings and added .gitattributes with **/*.rc text working-tree-encoding=UTF-16LE-BOM eol=CRLF. (I've converted all files to UTF-16 to simply use *.rc mask and not list all the files explicitly.)

But when I clone my repo and try git checkout to dev branch I see a lot of errors failed to encode '...' from UTF-8 to UTF-16LE-BOM, so it looks like git treats them as UTF-8 regardless of .gitattributes contents. Also after checkout all of the *.rc files become corrupted.

Before:

#include <winver.h>// Version Information#ifndef _DEBUG

After:

#include <winver.h>਍ഀഀ// Version Information਍⌀椀昀渀搀攀昀 开䐀䔀䈀唀䜀ഀഀ

Also If I type git status after checkout, git shows failed to encode '...' from UTF-16LE-BOM to UTF-8.

Is there any way to fix this?


Viewing all articles
Browse latest Browse all 1145

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>