As this might be useful to others, forwarding:

> Begin forwarded message:
> 
> Subject: Re: ZnUrl issue
> From: Sven Van Caekenberghe <s...@stfx.eu>
> Date: 5 Mar 2015 09:55:46 CET
> To: Gerhard Obermann <obi...@gmail.com>
> 
> Hi Gerhard,
> 
>> On 05 Mar 2015, at 08:36, Gerhard Obermann <obi...@gmail.com> wrote:
>> 
>> Hi sven,
>> 
>> We are using Zinc (Gemstone) to access a restful interface.
>> 
>> I didnt find a solution to send an url with german characters like "öäü".
>> Am i missing something?
>> 
>> All such tests fails:
>> 
>> ZnUrl fromString: '%F6lo'.
>> ZnUrl fromString: 'ölo'.
>> ZnUrl fromString: 'ölo' encodeAsUTF8 asString.
>> 
>> json := (client := ZnClient new)
>>              url: url;
>>              accept: ZnMimeType applicationJson;
>>              contentReader: [ :entity | | parserClass |
>>                      parserClass := Smalltalk at: #JSJsonParser.
>>                      parserClass parse: entity contents ];
>>              ifFail: [:ex | ^ self error: 'HTTP request failed!' ];
>>              get.
>> 
>> Regards Gerhard
> 
> This goes like this (in Pharo 4):
> 
> 'ä' utf8Encoded hex => 'c3a4'
> 
> 'http://de.wikipedia.de/wiki/Enzyklop%C3%A4die' asZnUrl.
> 
> ZnUrl new
>  scheme: #http;
>  host: 'de.wikipedia.de';
>  addPathSegment: #wiki;
>  addPathSegment: 'Enzyklopädie';
>  yourself.
> 
> Check the class comment: the print & parse forms are encoded, while the 
> components & accessors are not.
> 
> Does this work for you ?
> 
> Sven

Gerhard solved his use case as follows:

ZnUrl new
  scheme: #http;
  host: 'dev.virtualearth.net';
  addPathSegments: #('REST' 'v1' 'Locations');
  queryAt: 'query' add: 'Jägerstraße';
  yourself.   

Sven


Reply via email to