MCPcopy Index your code
hub / github.com/cli/cli / needsBom

Function needsBom

pkg/surveyext/editor_manual.go:30–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28}
29
30func needsBom() bool {
31 // The reason why we do this is because notepad.exe on Windows determines the
32 // encoding of an "empty" text file by the locale, for example, GBK in China,
33 // while golang string only handles utf8 well. However, a text file with utf8
34 // BOM header is not considered "empty" on Windows, and the encoding will then
35 // be determined utf8 by notepad.exe, instead of GBK or other encodings.
36
37 // This could be enhanced in the future by doing this only when a non-utf8
38 // locale is in use, and possibly doing that for any OS, not just windows.
39
40 return runtime.GOOS == "windows"
41}
42
43func edit(editorCommand, fn, initialValue string, stdin io.Reader, stdout io.Writer, stderr io.Writer, cursor showable, lookPath func(string) ([]string, []string, error)) (string, error) {
44 // prepare the temp file

Callers 1

editFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected