.scp extension visualized like binary file #5317
-
I'm using a macro creator program (Macro Scheduler) which use .scp files. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Generally speaking, if a file is being identified as binary by Linguist or GitHub it is because the mime-type is reporting it as such or it's explicitly enforced, like we do for PostScript and PDF files. In the case of the former, this can sometimes happen if the file contains a byte order mark. This isn't likely to be the latter case as Linguist doesn't know anything about Macro Scheduler or Can you provide a link to a repo showing these files and the problem so I can see which of these is at play. |
Beta Was this translation helpful? Give feedback.
-
Hi, If you try to change it and do a merge with a conflict you can't see differences because github see it like a binary file. |
Beta Was this translation helpful? Give feedback.
-
This is precisely the reason (and nothing to do with Linguist or even GitHub): your file has a little-endian byte order mark: $ file prova.scp
prova.scp: Little-endian UTF-16 Unicode text, with CRLF line terminators
$
$ ### See '<U+FEFF>' at the beginning of the file?
$ bat -p prova.scp
<U+FEFF>//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
Let>IGNORESPACES=1
SetFocus>{"Internet Explorer"}
Wait>WIN_DELAY
Let>clickTime=0
While>clickTime<3
Release MAIUSC
Press CTRL
Send>u
Wait>0.7
Let>clickTime=clickTime+1
EndWhile
$ GitHub and a lot of other plaintext tools don't play nicely with UTF-16 BOMs, even git: $ echo "foo" >> prova.scp
$ git --no-pager diff prova.scp
diff --git prova.scp prova.scp
index a37bf89..201b73e 100644
Binary files prova.scp and prova.scp differ
$ As you can see, this has nothing to do with Linguist or even GitHub. You can resolve this by configuring your tool to not use a BOM (I'm not sure if that's possible) or you'll need to remove them, either manually or using something like a pre-commit hook, for example: $ git restore prova.scp
$ dos2unix prova.scp
dos2unix: converting UTF-16LE file prova.scp to UTF-8 Unix format...
$ file prova.scp
prova.scp: ASCII text
$
$ ### See those chars have gone
$ bat -p prova.scp
//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
Let>IGNORESPACES=1
SetFocus>{"Internet Explorer"}
Wait>WIN_DELAY
Let>clickTime=0
While>clickTime<3
Release MAIUSC
Press CTRL
Send>u
Wait>0.7
Let>clickTime=clickTime+1
EndWhile
$
$ git add prova.scp
$ git commit -m 'Remove BOM'
[main f0031c5] Remove BOM
1 file changed, 0 insertions(+), 0 deletions(-)
rewrite prova.scp (100%)
$ echo "foo" >> prova.scp
$ git --no-pager diff prova.scp
diff --git prova.scp prova.scp
index d63b865..7d6f340 100644
--- prova.scp
+++ prova.scp
@@ -14,3 +14,4 @@ While>clickTime<3
Wait>0.7
Let>clickTime=clickTime+1
EndWhile
+foo
$ |
Beta Was this translation helpful? Give feedback.
Generally speaking, if a file is being identified as binary by Linguist or GitHub it is because the mime-type is reporting it as such or it's explicitly enforced, like we do for PostScript and PDF files. In the case of the former, this can sometimes happen if the file contains a byte order mark. This isn't likely to be the latter case as Linguist doesn't know anything about Macro Scheduler or
.scp
files so no deliberate override will exist.Can you provide a link to a repo showing these files and the problem so I can see which of these is at play.