Commit 85fb0be
Fix UTF-8 encoding issue in check-shellscript-set-options (#138)
The check-shellscript-set-options hook fails on Windows when processing
shell scripts containing UTF-8 characters (e.g., emojis) because it
opens files without specifying an encoding, defaulting to cp1252 on
Windows.
This commit adds explicit UTF-8 encoding when reading files to ensure
cross-platform compatibility.
Fixes the error:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position
3176:
character maps to <undefined>
Changes:
- filename.read_text() -> filename.read_text(encoding='utf-8')
- filename.open().readline() ->
filename.open(encoding='utf-8').readline()
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent 0ca8444 commit 85fb0be
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
0 commit comments