How to use encoding UTF8 instead of UTF-8 BOM in AHK Studio

Editor for AutoHotkey written completely in AutoHotkey.

Moderator: maestrith

NorInd
Posts: 43
Joined: 03 May 2020, 04:23

How to use encoding UTF8 instead of UTF-8 BOM in AHK Studio

Post by NorInd » 20 Dec 2020, 17:18

I have some questions on Encoding UTF8 in AHK Studio.
I use UTF-8 in most of my files (not limited to .ahk files, including .txt, .py, etc), and I don't like other encoding methods (eg: ANSI),
I don't like them because when I open a non-UTF-8 file in other software, sometimes the characters became gibberish.

1.
Question::
When we are dealing with special characters in .ahk files in Windows, do we have to encode .ahk files in UTF-8 BOM instead of UTF-8?

(This is what I am currently doing -- making .ahk into UTF-8 BOM if I have special characters in it. )
(PS: I was really bothering by this for a long time, and I heard many times that the BOM thing in Windows is really annoying, but I just could't get rid of it. )

2.
Question::
Can I get rid of the BOM in UTF-8 in AHK Studio? If yes, is it bad if I get rid of it?


Situation1::
When I created an test.ahk file in Notepad++, put some special characters (eg: α), save as UTF-8.
Then I open it in AHK Studio, the characters become gibberish.

When I created an test.ahk file in Notepad++, put some special characters (eg: α), save as UTF-8 BOM.
Then I open it in AHK Studio, everything was fine.

Situation2::
When I enabled the force UTF-8, and edited test.ahk in AHK Studio with special characters, and saved it. It would be saved in UTF-8 BOM, not UTF-8.
When I disabled the force UTF-8, and edited test.ahk in AHK Studio with special characters, and saved it. It would be saved in some Encoding methods.

Return to “AHK Studio”