google / glog

C++ implementation of the Google logging module
http://google.github.io/glog/
BSD 3-Clause "New" or "Revised" License
7k stars 2.05k forks source link

Support Unicode in paths #984

Open xfc1939 opened 9 months ago

xfc1939 commented 9 months ago

I am using log in Windows, and when the path contains a special space (hex code 0xc2a0), the log file cannot be created correctly."

sergiud commented 9 months ago

Your path contains the Unicode character U+00A0 in terms of a UTF-8 code point. AFAIK Windows does not support UTF-8 encoding for path specification in general. If this is still true, such a path would be indeed invalid.

xfc1939 commented 9 months ago

For non-English countries, it's very common that the path contains Unicode. I have checked the source code and found that the _open function cannot work correctly. Replacing it with _wopen may be a good choice.

sergiud commented 9 months ago

Replacing ANSI function variants by their Unicode counterparts is not sufficient. The path handling in environment variables, flags etc. must also be completely reworked.

xfc1939 commented 9 months ago

Support Unicode in paths https://github.com/google/glog/pull/998

sergiud commented 8 months ago

Thanks! #786 seems to be related.

xfc1939 commented 8 months ago

Thanks! #786 seems to be related.

The solution from #786 cannot resolve this question. it works if I set FLAGS_log_dir to a unicode path,but It cannot work when the path contains the Unicode character 0xc2a0. for example: log dir