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%26term%3Dscience%5Bjournal%5D%2BAND%2Bbreast%2Bcancer%2BAND%2B2009%5Bpdat%5D')
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%26term%3Dscience%5Bjournal%5D%2BAND%2Bbreast%2Bcancer%2BAND%2B2009%5Bpdat%5D')
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%26term%3Dscience%5Bjournal%5D%2BAND%2Bbreast%2Bcancer%2BAND%2B2009%5Bpdat%5D')
printString
'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb%3Dnuccore%26term%3Dscience%5Bjournal%5D%2BAND%2Bbreast%2Bcancer%2BAND%2B2009%5Bpdat%5D'
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%26term%3Dscience%5Bjournal%5D%2BAND%2Bbreast%2Bcancer%2BAND%2B2009%5Bpdat%5D'
> ) keys anyOne
>
> resulting in
>
> 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=nuccore&term=science[journal]+AND+breast+cancer+AND+2009[pdat]'
>
> 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%26term%3Dscience%5Bjournal%5D%2BAND%2Bbreast%2Bcancer%2BAND%2B2009%5Bpdat%5D'
> ) .... ?
>
> 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%26term%3Dscience%5Bjournal%5D%2BAND%2Bbreast%2Bcancer%2BAND%2B2009%5Bpdat%5D'
> unescapePercents
>
> 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=nuccore&term=science[journal]+AND+breast+cancer+AND+2009[pdat]'
>
> 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.
>