glog icon indicating copy to clipboard operation
glog copied to clipboard

Support Unicode in paths

Open xfc1939 opened this issue 2 years ago • 6 comments

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

xfc1939 avatar Dec 08 '23 12:12 xfc1939

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.

sergiud avatar Dec 08 '23 13:12 sergiud

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.

xfc1939 avatar Dec 09 '23 04:12 xfc1939

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

sergiud avatar Dec 09 '23 11:12 sergiud

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

xfc1939 avatar Dec 21 '23 16:12 xfc1939

Thanks! #786 seems to be related.

sergiud avatar Jan 03 '24 15:01 sergiud

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

xfc1939 avatar Jan 09 '24 05:01 xfc1939