Subject: Re: bug#24117: 25.1; url-http-create-request: Multibyte text in HTTP request

From: Dmitry Gutov <[email-masked]>
Date: Mon, 8 May 2017 16:36:36 +0300

On 11.08.2016 15:57, Ted Zlatanov wrote:

> DG> On 08/11/2016 11:53 AM, Ted Zlatanov wrote:
>>> Could you add to your patch the cases you've tested? There's a specific
>>> place for URL parsing tests in test/lisp/url/url-parse-tests.el that
>>> would help everyone.
> 
> DG> Sure, but only one of the patches affects URL parsing (and Lars prefers the
> DG> other one).
> 
> Maybe the tests should be in a separate patch then. Neither your Russian
> example nor Lars' example have a parallel in the tests AFAICS. I'd also
> add the example hostname that Katsumi Yamaoka gave from the w3m source.

Just got around to this. The test I came up with looks like this:

(ert-deftest url-generic-parse-url/multibyte-host-and-path ()
   (should (equal (url-generic-parse-url "http://банки.рф/фыва/")
                  (url-parse-make-urlobj "http" nil nil "банки.рф" nil
                                         "/фыва/" nil nil t))))

But! What behavior would this test? If we're making sure here that 
url-generic-parse-url can cope with multibyte characters anywhere in the 
URL, the encode-coding-string/decode-coding-string logic in 
url-encode-url is extraneous. I'm not sure that it is, or is there are 
some edge cases (are they fixable? should we add tests for them?).

So if this test goes in, it should be accompanied with the 
simplification of url-encode-url.

Lars, what do you think?