Commit 3011f69
fix: use _wfopen for non-ASCII log paths on Windows (#16)
* fix: use _wfopen for non-ASCII log paths on Windows
When the log directory path contains non-ASCII characters (e.g. CJK),
path.string() converts the internal wstring to narrow using the system
active code page (ACP), not UTF-8. On Chinese Windows (ACP=936/GBK),
this produces garbled bytes that cause fopen to throw an exception.
Using _wfopen with the wide string path directly preserves the characters
regardless of ACP setting.
* fix: check _wfopen return value to avoid UB
* fix(logger): report _wfopen failure instead of silent return
* Update Logger.cpp
---------
Co-authored-by: MistEO <mistereo@hotmail.com>1 parent 72c94c9 commit 3011f69
1 file changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
200 | | - | |
201 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
202 | 206 | | |
203 | 207 | | |
204 | 208 | | |
| |||
0 commit comments