RESOLVED FIXED Bug 15221
Make the FileSystemChooserGdk implementation properly convert the WebCore::String presentation
https://bugs.webkit.org/show_bug.cgi?id=15221
Summary Make the FileSystemChooserGdk implementation properly convert the WebCore::St...
Holger Freyther
Reported 2007-09-15 07:20:05 PDT
Currently the code assumes that the filesystem/system is using UTF-8. This assumption does not always hold true and there are the g_filename_convert_{from,to}_utf8 function to convert from the UTF-8 representation to the filesystem locale. Also implement proper NULL checking for the filechooser get_filename method.
Attachments
Properly convert the name of the file (3.09 KB, patch)
2007-09-15 07:21 PDT, Holger Freyther
aroben: review-
Convert properly (3.48 KB, patch)
2007-09-17 04:25 PDT, Holger Freyther
mrowe: review+
Holger Freyther
Comment 1 2007-09-15 07:21:37 PDT
Created attachment 16297 [details] Properly convert the name of the file This should implement the NULL-checking and should properly convert from WebCore::String -> UTF-8 -> filesystem and from filesystem -> UTF-8 -> WebCore::String.
Adam Roben (:aroben)
Comment 2 2007-09-16 13:16:06 PDT
Comment on attachment 16297 [details] Properly convert the name of the file + gchar* basename = g_filename_to_utf8(basenameSystem, -1, 0, 0, 0); + g_free(basenameSystem); + + if (basename) { + string = String::fromUTF8(basename); + g_free(basename); + } This sequence should be factored out into a static helper function instead of repeating it twice in this file. Otherwise looks good.
Holger Freyther
Comment 3 2007-09-17 04:25:27 PDT
Created attachment 16304 [details] Convert properly This takes the comments of Adam from this bug report and irc into account.
Mark Rowe (bdash)
Comment 4 2007-09-17 07:51:44 PDT
Comment on attachment 16304 [details] Convert properly I think "convertToStringByAdoptingTheFilesystemRepresentation" may be a little bit wordy. At the least, I think "The" does not add anything. Elsewhere we also treat "filesystem" as two words. Perhaps "stringWithFileSystemRepresentation" would be a better name? "filenameSystem" also feels backwards. "systemFilename" reads better to me. Other than these naming niggles, r=me.
Holger Freyther
Comment 5 2007-09-17 08:09:23 PDT
(In reply to comment #4) > (From update of attachment 16304 [details] [edit]) > I think "convertToStringByAdoptingTheFilesystemRepresentation" may be a little > bit wordy. At the least, I think "The" does not add anything. Elsewhere we > also treat "filesystem" as two words. Perhaps > "stringWithFileSystemRepresentation" would be a better name? > > "filenameSystem" also feels backwards. "systemFilename" reads better to me. > > Other than these naming niggles, r=me. > Oops, I landed that without reading that part. I agree with systemFilename and will do a fixup (without going through review) but the function name is difficult as it takes ownership of the systemFilename and we wanted to have that inside the name.
Note You need to log in before you can comment on or make changes to this bug.