stripUTF8BOM removes a leading UTF-8 byte-order mark from content read from a file or stdin. A BOM that survives into a CSV cell corrupts the first value (e.g. "\ufeffNorth", which then makes a MAXIFS/lookup miss it), and a BOM at the head of a JSON payload makes json.Unmarshal fail with "invalid ch
(s string)
| 1038 | // Some editors and exporters add it silently. Only a leading BOM is removed; interior |
| 1039 | // occurrences are left untouched. |
| 1040 | func stripUTF8BOM(s string) string { |
| 1041 | return strings.TrimPrefix(s, "\uFEFF") |
| 1042 | } |
| 1043 | |
| 1044 | // resolveInputFlags resolves @file and - (stdin) for flags with Input sources. |
| 1045 | // Must be called before Validate/DryRun/Execute so that runtime.Str() returns resolved content. |
no outgoing calls