Cool. Thanks Sven! 2011/4/7 Sven Van Caekenberghe <sven@beta9.be>:
Hernán,
From the class comment of ZnUrl:
[...]
    The methods in accessing protocols do not do any encoding, those in printing do.
[...]
Taking your example:
 (ZnUrl fromString: 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb%3Dnuccore%26t...') pathSegments
    an OrderedCollection('entrez' 'eutils' 'esearch.fcgi?db=nuccore&term=science[journal]+AND+breast+cancer+AND+2009[pdat]')
(ZnUrl fromString: 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb%3Dnuccore%26t...') path
    'entrez/eutils/esearch.fcgi?db=nuccore&term=science[journal]+AND+breast+cancer+AND+2009[pdat]'
(ZnUrl fromString: 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb%3Dnuccore%26t...') printString
    'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb%3Dnuccore%26t...'
If you inspect a ZnUrl instance you will notice that the internal Smalltalk representation is unencoded. But its #printString and the argument to #fromString: are. You could programmatically build up a ZnUrl using accessors and supplying unencoded (path) elements.
HTH,
Sven
On 06 Apr 2011, at 22:38, Hernán Morales Durand wrote:
Hi Sven,
In WebUtils one can decode an URL this way
( WebUtils decodeUrlEncodedForm: 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb%3Dnuccore%26t...' ) keys anyOne
resulting in
In Zinc-HTTP I didn't find a method for decoding an encoded HTTP address:
( ZnUrl fromString: 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb%3Dnuccore%26t...' ) .... ?
but there is #unescapePercents in Network package (by the way if it's the opposite of #encodeForHTTP shouldn't be #decodeFromHTTP ?)
'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb%3Dnuccore%26t...' unescapePercents
but I want to maximize package dependency and not system dependency. Is there a way to decode url's in Zinc-HTTP without use #unescapePercents ?
Cheers,
-- Hernán Morales Information Technology Manager, Institute of Veterinary Genetics. National Scientific and Technical Research Council (CONICET). La Plata (1900), Buenos Aires, Argentina. Telephone: +54 (0221) 421-1799. Internal: 422 Fax: 425-7980 or 421-1799.