Hi Gareth,
On 19 Mar 2018, at 15:23, Gareth
Cox <gareth@inspired.org> wrote:
Hi Sven
Is Zinc being overly fussy with encoding or is ASCII only URL
strings a standard.
the following fails in a workspace/playground.
'http://www.yr.no/place/Mexico/Nuevo_Le��n/Monterrey/forecast.xml'
asZnUrl
The url comes from the yr.no database (via api). It is
vaild if you paste into a browser.
Let me know what you think
Thanks
Gareth
(I am replying with CC to the ML for future reference).
When ZnUrl parses a string representation of a URL
it is indeed strict. As per the spec this must be ASCII.
Browsers typically allow a wider range of input.
But of course, these URLs are supported, you just
have to construct them differently. If you use the direct
construction API, you can use full Unicode.
ZnUrl new��
�� scheme: #http;��
�� addPathSegments: #('place' 'Mexico' 'Nuevo_Le��n'
'Monterrey' 'forecast.xml');
�� yourself.
You'll see that the external representation of your
URL is actually the following, which is acceptable to the
parser.
BTW, I would do your request as follows (using XML
Support) :
ZnClient new
�� systemPolicy;
�� http;
�� host: '
www.yr.no';��
�� addPath: #('place' 'Mexico' 'Nuevo_Le��n' 'Monterrey'
'forecast.xml');
�� accept: 'text/xml' asMIMEType;
�� contentReader: [ :entity | XMLDOMParser parse: entity contents
];
�� get.
In my Pharo 7 image, this gives me a nice coloured,
fully parsed DOM:
HTH,
Sven
��