uTox icon indicating copy to clipboard operation
uTox copied to clipboard

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

Open tsudoko opened this issue 9 years ago • 4 comments

tsudoko avatar May 03 '15 11:05 tsudoko

Does windows use UTF8 for filenames or some other encoding?

irungentoo avatar May 03 '15 14:05 irungentoo

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

tsudoko avatar May 03 '15 14:05 tsudoko

@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 avatar May 03 '15 17:05 GrayHatter

@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...

GrayHatter avatar May 03 '15 17:05 GrayHatter