Describe the feature or problem you’d like to solve
Not all CLI text editors handle UTF-8 BOMs "nicely" -- haivng it visible and needing to navigate over it, and be sure not to leave it in the middle of an edited file (such as a merge message) is not great for users.
Proposed solution
The code that writes the BOM has a comment indicating that it exists just as a hint/workaround for notepad.exe on Windows:
|
// The reason why we do this is because notepad.exe on Windows determines the |
|
// encoding of an "empty" text file by the locale, for example, GBK in China, |
If that comment is accurate, then the BOM writing could simply be limited to only running when runtime.GOOS == "Windows"?
If this is safe, it will make message editing a better, and less error-prone, experience for users on platforms that don't need it.
Describe the feature or problem you’d like to solve
Not all CLI text editors handle UTF-8 BOMs "nicely" -- haivng it visible and needing to navigate over it, and be sure not to leave it in the middle of an edited file (such as a merge message) is not great for users.
Proposed solution
The code that writes the BOM has a comment indicating that it exists just as a hint/workaround for
notepad.exeon Windows:cli/pkg/surveyext/editor_manual.go
Lines 43 to 44 in a9d397b
If that comment is accurate, then the BOM writing could simply be limited to only running when
runtime.GOOS == "Windows"?If this is safe, it will make message editing a better, and less error-prone, experience for users on platforms that don't need it.