emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: URL library problem


From: Stefan Monnier
Subject: Re: URL library problem
Date: Mon, 03 Oct 2005 10:36:25 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Note how explicit UTF-8 encoding helps nothing, because `url-request-data'
> is later concatenated with some strings turning multibyte again:

The problem here is not so much the use of string concatenation but the fact
that string concatenation uses string-make-multibyte rather than
string-to-multibyte.

Another way to look at it and to say that this concatenation should only be
done with unibyte strings, so those strings that are concatenated to your
string should all be made unibyte.

Would the patch below do the trick?


        Stefan


--- orig/lisp/url/url-http.el
+++ mod/lisp/url/url-http.el
@@ -198,7 +198,11 @@
     ;; allows us to elide null lines directly, at the cost of making
     ;; the layout less clear.
     (setq request
-         (concat
+         (mapconcat
+          ;; We'd really want here `string-to-unibyte', so as to signal an
+          ;; error if one of the strings contains a multibyte char.
+          'string-as-unibyte
+          (list
           ;; The request
           (or url-request-method "GET") " "
           (if proxy-obj (url-recreate-url proxy-obj) real-fname)
@@ -266,7 +270,8 @@
           ;; End request
           "\r\n"
           ;; Any data
-          url-request-data))
+          url-request-data)
+          ""))
     (url-http-debug "Request is: \n%s" request)
     request))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]