chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] [Q] uri-common has problem with UTF-8 uri.


From: Alex Shinn
Subject: Re: [Chicken-users] [Q] uri-common has problem with UTF-8 uri.
Date: Tue, 15 Jan 2013 12:20:38 +0900

On Tue, Jan 15, 2013 at 11:50 AM, Sungjin Chun <address@hidden> wrote:
My intention is to create search client for Solr (search server using lucene); where I should send
request URL like this;

  http://127.0.0.1:8983/solr/select?q=삼계탕&start=0&rows=10

I've tried to create this client using http-client egg and had found that it does not like UTF-8 characters
in the URL, so has my journey to hack started.

Ah, I see.  I had been building URIs directly with make-uri,
which accepts non-ASCII characters and encodes correctly
on output:

  (make-uri scheme: "http" host: "127.0.0.1"
                 path: '("" "solr" "select") query: '((q . "삼계탕")))

If you want to parse a string which is already an invalid URI,
you need a hack.  Treating it as an invalid IRI (invalid because
it doesn't allow http) and converting to a URI would work.

Alternately, the URI parsing procedures (and their usage from
http-client) could take an optional non-strict? parameter to allow
invalid characters.  It might make sense to make this the
default for http-client, since this is what browsers typically do -
allow invalid URIs but percent-encode them on request.

-- 
Alex


reply via email to

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