notsecure / uTox

Lightweight Tox client
utox.org
GNU General Public License v3.0
597 stars 149 forks source link

(xlib → win32 file transfers) File names contain mojibake when saved #1012

Open tsudoko opened 9 years ago

tsudoko commented 9 years ago

irungentoo commented 9 years ago

Does windows use UTF8 for filenames or some other encoding?

tsudoko commented 9 years ago

I think it uses UTF-16 for NTFS. https://msdn.microsoft.com/en-us/library/windows/desktop/dd317748%28v=vs.85%29.aspx http://stackoverflow.com/questions/2050973/what-encoding-are-filenames-in-ntfs-stored-as

GrayHatter commented 9 years ago

@irungentoo I was working on fixing this when the new api got released, so it got put onto the back burner. https://github.com/notsecure/uTox/milestones/unicode%20file%20transfers%20on%20windows is the milestone group for this.

I tried to translate the filename string with utf8_to_native(), which allows you to select the save file name you want to use. But then fopen() chokes on that data, not using the selected filename. I was in the process of writing a native_to_utf8() to translate the string back to something fopen() can use, and that's where I stalled. I'm looking for the branch/code now but it seems to have gone missing.

GrayHatter commented 9 years ago

@irungentoo windows does use utf-16, but after reading #1013 I wonder if utox assumes it's getting utf8 from windows file transfers, or if just accepts u16 and runs with it...