Closed Bug 943296 Opened 11 years ago Closed 9 years ago

widget/gtk/nsDragService.cpp should assume Gtk uses UTF-8

Categories

(Core :: Widget: Gtk, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: hsivonen, Assigned: hsivonen, Mentored)

References

Details

Attachments

(1 file, 1 obsolete file)

widget/gtk/nsDragService.cpp calls nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode and nsPrimitiveHelpers::ConvertUnicodeToPlatformPlainText. Since we already assume that *nix  platforms use UTF-8 as the platform  encoding these days, nsDragService should just assume UTF-8, too.
Blocks: 1003731
(In reply to Henri Sivonen (:hsivonen) from comment #0)
> Since we already
> assume that *nix  platforms use UTF-8 as the platform  encoding these days,
> nsDragService should just assume UTF-8, too.

That's not quite the right reason to fix this. The right reason is that for APIs other than those that deal with file system paths, Gtk has been UTF-8-only since version 2. The code in question here was migrated from Gtk1 until in compiled under Gtk2--leaving around cruft that was no longer needed or even correct--when it should have been rewritten as UTF-8-only for Gtk2 like nsClipboard.cpp was during the Gtk2 migration.
Mentor: hsivonen
Blocks: 1202362
Attached patch Assume UTF-8 (obsolete) — Splinter Review
The old code uses C strings instead of XPCOM strings. That's sad but out of scope for this patch.
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Attached patch Assume UTF-8, v2Splinter Review
Attachment #8669627 - Attachment is obsolete: true
Attachment #8672971 - Flags: review?(karlt)
Comment on attachment 8672971 [details] [diff] [review]
Assume UTF-8, v2

As you hint, this should all be replaced by gtk_selection_data_set_text()/_get_text()/_uris(), a bit like nsClipboard.
Some code could even be shared.

This patch is kind of a step in that direction, thanks.
Attachment #8672971 - Flags: review?(karlt) → review+
Blocks: 1214616
https://hg.mozilla.org/mozilla-central/rev/07fe0365048c
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: