On Geany 1.38 when editing `.sh` or `.conf` files three additional `0x00` characters are added.
On execute, script returns ` cannot execute binary file: Exec format error`.
Hexdump
![Geanie_Screenshot](https://user-images.githubusercontent.com/9049878/222925981-547eecd1-183d-4e...)
for
``` #!/bin/bash
if [ $user ```
File type is set to `Shell script`. I tried UTF-7, UTF-8 encoding and none.
Can you share the file? *Document → Set Encoding → Unicode → UTF-8* *should* change that to well, UTF-8. Make sure *Document → Write Unicode BOM* is *not* checked as well, that could confuse tools.
Thanks,
The source of my issue, is that I had set UTF-32BE as the encoding default.
Edit→ Preferences → Files → Encodings → Default encoding (new files)
I expected
Document → Set Filetype → Scripting Languages → Shell script
to set encoding according to the Filetype intent.
I expected
Document → Set Filetype → Scripting Languages → Shell script
to set encoding according to the Filetype intent.
It's unrelated, nothing prevents you from saving something you display as shell script in UTF-32 or anything else. And actually, not only preventing that could prevent legitimate use case, but it'd also be terribly tricky, because there's a very large variety of encoding that offer enough similarities so that they work, yet some don't. OK, UTF-16 and 32 have against them they obviously aren't ASCII-compatible, so anything that don't understand encoding but expect ASCII will not like it, but some odd 7 or 8 bit encodings are not ASCII compatible in ways that do or don't affect specific compilers, interpreters or other tools. Bottom line is, encodings are complicated, and support for each en every one of them varies wildly depending on way too many parameters specific to a use case. Yet usually, using BOM-less UTF-8 is pretty safe nowadays. But sometimes another encoding might actually not be an error (as a matter of opinion though).
Closed #3423 as completed.
It does make sense to segregate file types and encoding.
Besides `filestype.sh` could possibly be used to set a default encoding, either that or create a template.
github-comments@lists.geany.org