aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2004-04-02 17:29:52 +0000
committerJan Djärv2004-04-02 17:29:52 +0000
commitbcfa9925a6e20dcc00ad7a18cb5b577dba018aca (patch)
tree8f9c0f637b1318504cc7c9fe2660c47a927ab460
parent78cfc6adfc7923f630cc3a821ecd85d2cc105518 (diff)
downloademacs-bcfa9925a6e20dcc00ad7a18cb5b577dba018aca.tar.gz
emacs-bcfa9925a6e20dcc00ad7a18cb5b577dba018aca.zip
* x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
utf-16le on little endian machines and utf-16be otherwise.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/x-dnd.el11
2 files changed, 14 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 918c16382b2..cb1d8d0e4ae 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12004-04-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
4 utf-16le on little endian machines and utf-16be otherwise.
5
12004-04-02 David Kastrup <dak@gnu.org> 62004-04-02 David Kastrup <dak@gnu.org>
2 7
3 * net/browse-url.el (browse-url-generic): Use call-process 8 * net/browse-url.el (browse-url-generic): Use call-process
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index 91ca053afa2..cdb0a63ace6 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -336,7 +336,12 @@ WINDOW is the window where the drop happened. ACTION is ignored.
336DATA is the moz-url, which is formatted as two strings separated by \r\n. 336DATA is the moz-url, which is formatted as two strings separated by \r\n.
337The first string is the URL, the second string is the title of that URL. 337The first string is the URL, the second string is the title of that URL.
338DATA is encoded in utf-16. Decode the URL and call `x-dnd-handle-uri-list'." 338DATA is encoded in utf-16. Decode the URL and call `x-dnd-handle-uri-list'."
339 (let* ((string (decode-coding-string data 'utf-16le)) ;; ALWAYS LE??? 339 ;; Mozilla and applications based on it (Galeon for example) uses
340 ;; text/unicode, but it is impossible to tell if it is le or be. Use what
341 ;; the machine Emacs runs on use. This looses if dropping between machines
342 ;; with different endian, but it is the best we can do.
343 (let* ((coding (if (eq (byteorder) ?B) 'utf-16be 'utf-16le))
344 (string (decode-coding-string data coding))
340 (strings (split-string string "[\r\n]" t)) 345 (strings (split-string string "[\r\n]" t))
341 ;; Can one drop more than one moz-url ?? Assume not. 346 ;; Can one drop more than one moz-url ?? Assume not.
342 (url (car strings)) 347 (url (car strings))
@@ -351,7 +356,9 @@ TEXT is the text as a string, WINDOW is the window where the drop happened."
351(defun x-dnd-insert-utf16-text (window action text) 356(defun x-dnd-insert-utf16-text (window action text)
352 "Decode the UTF-16 text and insert it at point. 357 "Decode the UTF-16 text and insert it at point.
353TEXT is the text as a string, WINDOW is the window where the drop happened." 358TEXT is the text as a string, WINDOW is the window where the drop happened."
354 (x-dnd-insert-text window action (decode-coding-string text 'utf-16le))) 359 ;; See comment in x-dnd-handle-moz-url about coding.
360 (let ((coding (if (eq (byteorder) ?B) 'utf-16be 'utf-16le)))
361 (x-dnd-insert-text window action (decode-coding-string text coding))))
355 362
356(defun x-dnd-insert-ctext (window action text) 363(defun x-dnd-insert-ctext (window action text)
357 "Decode the compound text and insert it at point. 364 "Decode the compound text and insert it at point.