Pharo-users
By thread
pharo-users@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
June 2015
- 95 participants
- 612 messages
Re: [Pharo-users] ZnClient and percent characters
by Norbert Hartl
I was thinking of a reliable solution. Of course if it only needs to be tested than monkey patching foreign packages is ok.
Norbert
> Am 11.06.2015 um 01:22 schrieb PBKResearch <peter(a)pbkresearch.co.uk>:
>
> There is a simpler way than Norbertâs suggestion. Find the class ZnResourceMetaUtils (in the package Zinc-Resource-Meta-Core). Locate the class side method #queryKeyValueSafeSet. Remove the comma from the string. With this change your âGoogleâ example generates the query line with the â%2Câ encoding of the commas.
>
> Of course, with this change a comma in the value field of a query will always be encoded. It is not clear to me whether this is correcting an error in Zinc, or just a hack to solve your problem â earlier posts here endorse both views. No doubt Sven is the person to sort this out. Meanwhile, this will enable you to get moving.
>
> Hope this helps
>
> Peter Kenny
>
> From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Norbert Hartl
> Sent: 10 June 2015 23:56
> To: Pharo users users
> Subject: Re: [Pharo-users] ZnClient and percent characters
>
> Just to clarify:
>
> "Characters in the "reserved" set are not reserved in all contexts.
> The set of characters actually reserved within any given URI
> component is defined by that component. In general, a character is
> reserved if the semantics of the URI changes if the character is
> replaced with its escaped US-ASCII encoding."
> If I were you I'd subclass ZnUrl and implement
> #encodeQuery:on:
> on that class. You could have an extension method in ZnResourceMetaUtils that returns the character set you need to have encoded. In ZnClient you just set your ZnUrl derived class object as #url:
> Cannot think of anything better for a quick resolve of your problem.
> Norbert
>> Am 11.06.2015 um 00:26 schrieb Jimmie Houchin <jlhouchin(a)gmail.com <mailto:jlhouchin@gmail.com>>:
>>
>> I am not an expert on URIs or encoding. However, this is a requirement of the API I am using and I am required to submit an encoded URI with %2C and no commas.
>>
>> As far as commas needing to be escaped, it seems from other sources that they should be.
>>
>> From https://www.ietf.org/rfc/rfc2396.txt <https://www.ietf.org/rfc/rfc2396.txt>
>>
>> The plus "+", dollar "$", and comma "," characters have been added to
>> those in the "reserved" set, since they are treated as reserved
>> within the query component.
>>
>> States that commas are reserved within the query component.
>>
>> http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded <http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded>
>>
>> Regardless of what is or is not required, I do need the ability to have a query string with commas encoded as %2C in order to satisfy and use the API which states.
>>
>> fields: Optional An URL encoded (%2C) comma separated list of instrument fields that are to be returned in the response. The instrument field will be returned regardless of the input to this query parameter. Please see the Response Parameters section below for a list of valid values.
>>
>> Which will look like this or something similar.
>>
>> fields=displayName%2Cinstrument%2Cpip
>>
>>
>> Thanks.
>>
>> Jimmie
>>
>> On 06/10/2015 03:27 PM, Norbert Hartl wrote:
>>> That's because the comma does not need to be escaped in the query part of the uri.
>>>
>>> Norbert
>>>
>>>> Am 10.06.2015 um 22:00 schrieb Jimmie Houchin <jlhouchin(a)gmail.com> <mailto:jlhouchin@gmail.com>:
>>>>
>>>> On 06/10/2015 10:32 AM, Sven Van Caekenberghe wrote:
>>>>>> On 10 Jun 2015, at 17:24, David <stormbyte(a)gmail.com> <mailto:stormbyte@gmail.com> wrote:
>>>>>>
>>>>>> El Wed, 10 Jun 2015 10:14:37 -0500
>>>>>> Jimmie Houchin <jlhouchin(a)gmail.com> <mailto:jlhouchin@gmail.com>
>>>>>> escribió:
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am attempting to use ZnClient to request data. The request requires
>>>>>>> a %2C (comma) delimited string as part of the query. Below is a
>>>>>>> snippet.
>>>>>>>
>>>>>>> znClient
>>>>>>> addPath: '/v1/instruments';
>>>>>>> queryAt: 'fields' putAll: 'displayName%2Cinstrument%2Cpip';
>>>>>>> get ;
>>>>>>> contents)
>>>>>>>
>>>>>>> The string 'displayName%2Cinstrument%2Cpip'
>>>>>>> is being converted to 'displayName%252Cinstrument%252Cpip'
>>>>>>> which causes the request to fail.
>>>>>>>
>>>>>>> The query needs to be
>>>>>>> fields=displayName%2Cinstrument%2Cpip
>>>>>>>
>>>>>>> I have not found how to do this correctly.
>>>>>>> Any help greatly appreciated.
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> Jimmie
>>>>>>>
>>>>>>>
>>>>>> Maybe a silly thing, but since %2C = , ... Did you tried already to
>>>>>> make itself encode that? Like
>>>>>> znClient
>>>>>> addPath: '/v1/instruments';
>>>>>> queryAt: 'fields' putAll: 'displayName,instrument,pip';
>>>>>> get ;
>>>>>> contents)
>>>>>>
>>>>>> I suspect it is using encoding internally, that is why % is also
>>>>>> encoded if you try to put it.
>>>>>>
>>>>>> I hope that works
>>>>> Not silly and no need to suspect, but absolutely correct !
>>>>>
>>>>> Sven
>>>> My apologies for not having full disclosure.
>>>>
>>>> Pharo 4, new image, freshly installed Zinc stable version.
>>>> Xubuntu 15.04
>>>>
>>>>
>>>>
>>>> That is what I thought would happen and what I tried first. But it is not being encoded from what I can find.
>>>>
>>>> Inspect this in a workspace/playground.
>>>>
>>>> ZnClient new
>>>> https;
>>>> host: 'google.com <http://google.com/>';
>>>> addPath: '/commaTest';
>>>> queryAt: 'fields' put: 'displayName,instrument,pip';
>>>> yourself
>>>>
>>>> View the request / requestLine / uri. The commas are still present in the URI.
>>>> So I tried encoding myself and get the other error.
>>>>
>>>> Of course Google won't understand this and in this snippet won't receive it.
>>>>
>>>> And please let me know if I am doing something wrong.
>>>>
>>>> Any help greatly appreciated.
>>>>
>>>> Jimmie
June 11, 2015
Re: [Pharo-users] World lastKeystroke and openInWorld: aPasteUpMorph
by Markus Schlager
Hi Johan,
On Wed, 10 Jun 2015, Johan Fabry wrote:
> this is probably not how it should be done, but to get the last keystroke I have been doing the following:
>
> World activeHand instVarNamed: #lastKeyScanCode
>
> If you find a cleaner way Iâd be grateful if you can share it.
The solution proposed by PharoByExample, p. 228 is to override
Morph>>handleKeystroke:
---8X---------------------------------
Morph subclass: #MyMorph
MyMorph>>handleKeystroke: anEvent
| keyValue keyName |
keyValue := anEvent keyValue. "integer"
keyName := anEvent keyString. "string like '<up>' or 'a'"
...
m := MyMorph new.
m takeKeyboardFocus.
---8X---------------------------------
Markus
June 11, 2015
New Tool: Catalog Browser in Pharo 5.0
by Torsten Bergmann
Hi,
maybe you already noticed. The latest update for Pharo 5 which is 50103 (see [1]).
includes a new tool called "Catalog Browser".
Where to go
===========
You will find it under "Tools" -> "Catalog Browser" and it will display the
configs together with the catalog metadata like project description.
The code is managed with a configuration similar to what we have for
a few other packages/projects. The tool was written by Esteban Lorenzano with small
improvements like spotter integration from my side. Feel free to contribute more features.
The repository can be found on SmalltalkHub [2].
This new tool basically gives you access to all available configurations
aggregated at [3]. You can use a small UI to search and load the configs
(see world menu -> "Tools" -> "Catalog Browser".
But you can also use Spotter to load a config.
Example on how to load ScriptManager config:
============================================
- open Spotter (SHIFT + ENTER on Windows, ...)
- type in "Script" and you will find a spotter category "Catalog Projects" with "ScriptManager" in it
- just hit enter and the config is loaded
Same for all others, so try with "Seaside", "MongoTalk", ...
In the short/mid-term this new tool should replace the existing config browser as it
gives more informations about the projects.
What to do next:
================
- give feedback
- we should update all our configs with catalog descriptions
- it would be nice if the spotter integration would include also a preview of the project
description
- ...
If you want to contribute just tell Esteban so he can add you to the project.
Thanks
Esteban & Torsten
[1] http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2015-June/110964…
[2] http://www.smalltalkhub.com/#!/~estebanlm/CatalogBrowser
[3] http://catalog.pharo.org/catalog/json
June 11, 2015
Re: [Pharo-users] ZnClient and percent characters
by Sven Van Caekenberghe
@everybody
The key method that defines how the query part of a URL is percent encoded is ZnMetaResourceUtils class>>#querySafeSet
Years ago, Zinc HTTP Components followed the better safe than sorry approach of encoding almost every character except for the ones that are safe in all contexts.
Later on, we began reading the specs better and decided to follow them more closely, that is why there are now different safe sets.
Now, we can (and should) all read the different specs, and try to learn from things in the wild as well from other implementations.
The quote from http://en.wikipedia.org/wiki/Query_string was incomplete, it said 'for HTML 5 when submitting a form using GET', which is a very specific context.
ZnUrl was written against RFC 3986 mostly.
Now, maybe we made a mistake, maybe not.
But maybe it also would be a good idea to allow users to decide this for themselves on a case by case basis.
> On 11 Jun 2015, at 05:18, Jimmie Houchin <jlhouchin(a)gmail.com> wrote:
>
> Thanks for the reply.
>
> I implemented Peter's suggestion as an easy keep moving solution.
>
> As I said, I am not expert in what is or is not legal according to the standards.
> However, looking at Python, their urllib library in the quote and urlencode methods they encode the commas by default.
>
> _ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
> b'abcdefghijklmnopqrstuvwxyz'
> b'0123456789'
> b'_.-')
>
> https://docs.python.org/3/library/urllib.parse.html
> https://hg.python.org/cpython/file/3.4/Lib/urllib/parse.py
>
> That's at least how one major language understands the standard. And Python 2.7 is the same.
>
> According to Wikipedia
> http://en.wikipedia.org/wiki/Query_string
> ⢠Characters that cannot be converted to the correct charset are replaced with HTML numeric character references[9]
> ⢠SPACE is encoded as '+'
> ⢠Letters (AâZ and aâz), numbers (0â9) and the characters '*','-','.' and '_' are left as-is
>
> It appeared in the stackoverflow article I quoted previously that ASP.NET encodes commas. I could misunderstand or be reading into it.
> http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded
> Just a little more information to add to the discussion.
>
> Thanks.
>
> Jimmie
>
>
>
>
> On 06/10/2015 05:56 PM, Norbert Hartl wrote:
>> Just to clarify:
>>
>> "
>> Characters in the "reserved" set are not reserved in
>> all contexts.
>>
>> The set of characters actually reserved within any given URI
>> component is defined by that component. In general, a character is
>> reserved if the semantics of the URI changes if the character is
>> replaced with its escaped US-ASCII encoding."
>>
>> If I were you I'd subclass ZnUrl and implement
>> #encodeQuery:on:
>> on that class. You could have an extension method in ZnResourceMetaUtils that returns the character set you need to have encoded. In ZnClient you just set your ZnUrl derived class object as #url:
>> Cannot think of anything better for a quick resolve of your problem.
>> Norbert
>>> Am 11.06.2015 um 00:26 schrieb Jimmie Houchin <jlhouchin(a)gmail.com>:
>>>
>>> I am not an expert on URIs or encoding. However, this is a requirement of the API I am using and I am required to submit an encoded URI with %2C and no commas.
>>>
>>> As far as commas needing to be escaped, it seems from other sources that they should be.
>>>
>>> From https://www.ietf.org/rfc/rfc2396.txt
>>> The plus "+", dollar "$", and comma "," characters have been added to
>>> those in the "reserved" set, since they are treated as reserved
>>> within the query component.
>>>
>>> States that commas are reserved within the query component.
>>>
>>>
>>> http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded
>>>
>>>
>>> Regardless of what is or is not required, I do need the ability to have a query string with commas encoded as %2C in order to satisfy and use the API which states.
>>>
>>> fields: Optional An URL encoded (%2C) comma separated list of instrument fields that are to be returned in the response. The instrument field will be returned regardless of the input to this query parameter. Please see the Response Parameters section below for a list of valid values.
>>>
>>> Which will look like this or something similar.
>>>
>>> fields=displayName%2Cinstrument%2Cpip
>>>
>>>
>>> Thanks.
>>>
>>> Jimmie
>>>
>>>
>>> On 06/10/2015 03:27 PM, Norbert Hartl wrote:
>>>> That's because the comma does not need to be escaped in the query part of the uri.
>>>>
>>>> Norbert
>>>>
>>>>
>>>>> Am 10.06.2015 um 22:00 schrieb Jimmie Houchin <jlhouchin(a)gmail.com>
>>>>> :
>>>>>
>>>>> On 06/10/2015 10:32 AM, Sven Van Caekenberghe wrote:
>>>>>
>>>>>>> On 10 Jun 2015, at 17:24, David <stormbyte(a)gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>> El Wed, 10 Jun 2015 10:14:37 -0500
>>>>>>> Jimmie Houchin
>>>>>>> <jlhouchin(a)gmail.com>
>>>>>>>
>>>>>>> escribió:
>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> I am attempting to use ZnClient to request data. The request requires
>>>>>>>> a %2C (comma) delimited string as part of the query. Below is a
>>>>>>>> snippet.
>>>>>>>>
>>>>>>>> znClient
>>>>>>>> addPath: '/v1/instruments';
>>>>>>>> queryAt: 'fields' putAll: 'displayName%2Cinstrument%2Cpip';
>>>>>>>> get ;
>>>>>>>> contents)
>>>>>>>>
>>>>>>>> The string 'displayName%2Cinstrument%2Cpip'
>>>>>>>> is being converted to 'displayName%252Cinstrument%252Cpip'
>>>>>>>> which causes the request to fail.
>>>>>>>>
>>>>>>>> The query needs to be
>>>>>>>> fields=displayName%2Cinstrument%2Cpip
>>>>>>>>
>>>>>>>> I have not found how to do this correctly.
>>>>>>>> Any help greatly appreciated.
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>> Jimmie
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> Maybe a silly thing, but since %2C = , ... Did you tried already to
>>>>>>> make itself encode that? Like
>>>>>>> znClient
>>>>>>> addPath: '/v1/instruments';
>>>>>>> queryAt: 'fields' putAll: 'displayName,instrument,pip';
>>>>>>> get ;
>>>>>>> contents)
>>>>>>>
>>>>>>> I suspect it is using encoding internally, that is why % is also
>>>>>>> encoded if you try to put it.
>>>>>>>
>>>>>>> I hope that works
>>>>>>>
>>>>>> Not silly and no need to suspect, but absolutely correct !
>>>>>>
>>>>>> Sven
>>>>>>
>>>>> My apologies for not having full disclosure.
>>>>>
>>>>> Pharo 4, new image, freshly installed Zinc stable version.
>>>>> Xubuntu 15.04
>>>>>
>>>>>
>>>>>
>>>>> That is what I thought would happen and what I tried first. But it is not being encoded from what I can find.
>>>>>
>>>>> Inspect this in a workspace/playground.
>>>>>
>>>>> ZnClient new
>>>>> https;
>>>>> host: '
>>>>> google.com
>>>>> ';
>>>>> addPath: '/commaTest';
>>>>> queryAt: 'fields' put: 'displayName,instrument,pip';
>>>>> yourself
>>>>>
>>>>> View the request / requestLine / uri. The commas are still present in the URI.
>>>>> So I tried encoding myself and get the other error.
>>>>>
>>>>> Of course Google won't understand this and in this snippet won't receive it.
>>>>>
>>>>> And please let me know if I am doing something wrong.
>>>>>
>>>>> Any help greatly appreciated.
>>>>>
>>>>> Jimmie
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
June 11, 2015
Re: [Pharo-users] Using GTSpotter how do I find an implementor of #accept ?
by Ben Coman
On Thu, Jun 11, 2015 at 1:05 PM, Paul DeBruicker <pdebruic(a)gmail.com> wrote:
> Hi Doru,
>
> By "the old version of Spotter" I meant whatever was in Pharo 3 that would
> produce a list of search results with exact matches at the top
I believe that was called Spotlight.
cheers -ben
June 11, 2015
Re: [Pharo-users] Using GTSpotter how do I find an implementor of #accept ?
by Paul DeBruicker
Hi Doru,
By "the old version of Spotter" I meant whatever was in Pharo 3 that would
produce a list of search results with exact matches at the top when I'd hit
shift+enter and then type e.g. 'accept.' Sorry to have said "Pharo 4" &
been unnecessarily confusing.
I'm just going to use 'accept' for this example but why show the mixed list
of 637 implementors of accept* and not lead with "accept". Why was it
decided that inexact matches to the typed input be privileged above exact
matches in the new tool? Is it a bad Levenshtein distance algorithm or
something?
Thanks for helping me figure it out
Paul
Tudor Girba-2 wrote
> Hi,
>
> What do you mean by the old version of Spotter?
>
> Just in case: you should know that Spotter is made to be extensible. This
> means that if you want to play with your own way of searching for objects,
> you can just do it. Let me know if you to try and if you need help in this
> direction.
>
> Cheers,
> Doru
>
>
>
> On Wed, Jun 10, 2015 at 9:10 PM, Paul DeBruicker <
> pdebruic@
> > wrote:
>
>>
>> Is there any way to change back to the old version of Spotter in Pharo 4?
>>
>>
>>
>>
>>
>> Nicolai Hess wrote
>> > 2015-06-10 16:24 GMT+02:00 Paul DeBruicker <
>>
>> > pdebruic@
>>
>> > >:
>> >
>> >> So by default the search tool is only guaranteed to return an exact
>> term
>> >> match if there are only less than 5 non-exact match results?
>> >>
>> >>
>> > Yes
>> >
>> >
>> >
>> >
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> Nicolai Hess wrote
>> >> > 2015-06-10 7:39 GMT+02:00 Paul DeBruicker <
>> >>
>> >> > pdebruic@
>> >>
>> >> > >:
>> >> >
>> >> >> when I hit shift+enter and type 'accept' I get things that are not
>> >> >> #accept, e.g. #accept: and AbstractAcceptor.
>> >> >>
>> >> >> If I add a space after accept it doesn't help.
>> >> >>
>> >> >>
>> >> >> What do I not understand?
>> >> >>
>> >> >
>> >> > the result list is not sorted and the result list is built by all
>> >> methods
>> >> > having the query string as part
>> >> > of its selector name.
>> >> >
>> >> > Yes this can be improved and it is not difficult, for example you
>> can
>> >> add
>> >> > this method to
>> >> >
>> >> > GTFilterImplementor>>applyFilterWithQuery
>> >> > super applyFilterWithQuery.
>> >> > items sort: [ :a :b | (self itemFilterNameFor: a) size < (self
>> >> > itemFilterNameFor: b) size ]
>> >> >
>> >> > this will sort the result list by the size of the selector name. So,
>> if
>> >> > there is a perfect match,
>> >> > it will be listed first.
>> >> > (BUT only in the implementors category if you "dive-in", not in the
>> >> > 5-elements-result-preview-list).
>> >> >
>> >> > Maybe there is a better way without sorting. (We can modify
>> >> > applyFilterWithQuery for the implementors
>> >> > filter, to put perfect matches at the begining of the list).
>> >> >
>> >> > But all this is not easy to discover. Spotter classes make some
>> heavy
>> >> use
>> >> > of delegation, many operations
>> >> > are split and delgated to subclasses (GOOD!)
>> >> > many classes aren't documented (BAD!) and this makes it really
>> >> difficult
>> >> > to
>> >> > catch how all this is supposed to work together.
>> >> >
>> >> >
>> >> > nicolai
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >>
>> >> >>
>> >> >> Thanks
>> >> >>
>> >> >>
>> >> >> Paul
>> >> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://forum.world.st/Using-GTSpotter-how-do-I-find-an-implementor-of-accep…
>> >> Sent from the Pharo Smalltalk Users mailing list archive at
>> Nabble.com.
>> >>
>> >>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Using-GTSpotter-how-do-I-find-an-implementor-of-accep…
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>
>>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"
--
View this message in context: http://forum.world.st/Using-GTSpotter-how-do-I-find-an-implementor-of-accep…
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
June 11, 2015
Re: [Pharo-users] ZnClient and percent characters
by Jimmie Houchin
Thanks for the reply.
I implemented Peter's suggestion as an easy keep moving solution.
As I said, I am not expert in what is or is not legal according to the
standards.
However, looking at Python, their urllib library in the quote and
urlencode methods they encode the commas by default.
_ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
b'abcdefghijklmnopqrstuvwxyz'
b'0123456789'
b'_.-')
https://docs.python.org/3/library/urllib.parse.html
https://hg.python.org/cpython/file/3.4/Lib/urllib/parse.py
That's at least how one major language understands the standard. And
Python 2.7 is the same.
According to Wikipedia
http://en.wikipedia.org/wiki/Query_string
# Characters that cannot be converted to the correct charset are replaced
with HTMLnumeric character references
<http://en.wikipedia.org/wiki/Numeric_character_reference>^[9]
<http://en.wikipedia.org/wiki/Query_string#cite_note-html5_urlencoded-9>
# SPACE is encoded as '|+|'
# Letters (|A|â|Z|and|a|â|z|), numbers (|0|â|9|) and the characters
'|*|','|-|','|.|' and '|_|' are left as-is
It appeared in the stackoverflow article I quoted previously that
ASP.NET encodes commas. I could misunderstand or be reading into it.
http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded
Just a little more information to add to the discussion.
Thanks.
Jimmie
On 06/10/2015 05:56 PM, Norbert Hartl wrote:
> Just to clarify:
>
> "Characters in the "reserved" set are not reserved in all contexts.
> The set of characters actually reserved within any given URI
> component is defined by that component. In general, a character is
> reserved if the semantics of the URI changes if the character is
> replaced with its escaped US-ASCII encoding."
> If I were you I'd subclass ZnUrl and implement
> #encodeQuery:on:
> on that class. You could have an extension method in ZnResourceMetaUtils that returns the character set you need to have encoded. In ZnClient you just set your ZnUrl derived class object as #url:
> Cannot think of anything better for a quick resolve of your problem.
> Norbert
>> Am 11.06.2015 um 00:26 schrieb Jimmie Houchin <jlhouchin(a)gmail.com
>> <mailto:jlhouchin@gmail.com>>:
>>
>> I am not an expert on URIs or encoding. However, this is a
>> requirement of the API I am using and I am required to submit an
>> encoded URI with %2C and no commas.
>>
>> As far as commas needing to be escaped, it seems from other sources
>> that they should be.
>>
>> From https://www.ietf.org/rfc/rfc2396.txt
>> The plus "+", dollar "$", and comma "," characters have been added to
>> those in the "reserved" set, since they are treated as reserved
>> within the query component.
>>
>> States that commas are reserved within the query component.
>>
>> http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded
>>
>> Regardless of what is or is not required, I do need the ability to have a query string with commas encoded as %2C in order to satisfy and use the API which states.
>>
>> fields: Optional An URL encoded (%2C) comma separated list of instrument fields that are to be returned in the response. The instrument field will be returned regardless of the input to this query parameter. Please see the Response Parameters section below for a list of valid values.
>>
>> Which will look like this or something similar.
>>
>> fields=displayName%2Cinstrument%2Cpip
>>
>>
>> Thanks.
>>
>> Jimmie
>>
>> On 06/10/2015 03:27 PM, Norbert Hartl wrote:
>>> That's because the comma does not need to be escaped in the query part of the uri.
>>>
>>> Norbert
>>>
>>>> Am 10.06.2015 um 22:00 schrieb Jimmie Houchin<jlhouchin(a)gmail.com>:
>>>>
>>>> On 06/10/2015 10:32 AM, Sven Van Caekenberghe wrote:
>>>>>> On 10 Jun 2015, at 17:24, David<stormbyte(a)gmail.com> wrote:
>>>>>>
>>>>>> El Wed, 10 Jun 2015 10:14:37 -0500
>>>>>> Jimmie Houchin<jlhouchin(a)gmail.com>
>>>>>> escribió:
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am attempting to use ZnClient to request data. The request requires
>>>>>>> a %2C (comma) delimited string as part of the query. Below is a
>>>>>>> snippet.
>>>>>>>
>>>>>>> znClient
>>>>>>> addPath: '/v1/instruments';
>>>>>>> queryAt: 'fields' putAll: 'displayName%2Cinstrument%2Cpip';
>>>>>>> get ;
>>>>>>> contents)
>>>>>>>
>>>>>>> The string 'displayName%2Cinstrument%2Cpip'
>>>>>>> is being converted to 'displayName%252Cinstrument%252Cpip'
>>>>>>> which causes the request to fail.
>>>>>>>
>>>>>>> The query needs to be
>>>>>>> fields=displayName%2Cinstrument%2Cpip
>>>>>>>
>>>>>>> I have not found how to do this correctly.
>>>>>>> Any help greatly appreciated.
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> Jimmie
>>>>>>>
>>>>>>>
>>>>>> Maybe a silly thing, but since %2C = , ... Did you tried already to
>>>>>> make itself encode that? Like
>>>>>> znClient
>>>>>> addPath: '/v1/instruments';
>>>>>> queryAt: 'fields' putAll: 'displayName,instrument,pip';
>>>>>> get ;
>>>>>> contents)
>>>>>>
>>>>>> I suspect it is using encoding internally, that is why % is also
>>>>>> encoded if you try to put it.
>>>>>>
>>>>>> I hope that works
>>>>> Not silly and no need to suspect, but absolutely correct !
>>>>>
>>>>> Sven
>>>> My apologies for not having full disclosure.
>>>>
>>>> Pharo 4, new image, freshly installed Zinc stable version.
>>>> Xubuntu 15.04
>>>>
>>>>
>>>>
>>>> That is what I thought would happen and what I tried first. But it is not being encoded from what I can find.
>>>>
>>>> Inspect this in a workspace/playground.
>>>>
>>>> ZnClient new
>>>> https;
>>>> host: 'google.com <http://google.com>';
>>>> addPath: '/commaTest';
>>>> queryAt: 'fields' put: 'displayName,instrument,pip';
>>>> yourself
>>>>
>>>> View the request / requestLine / uri. The commas are still present in the URI.
>>>> So I tried encoding myself and get the other error.
>>>>
>>>> Of course Google won't understand this and in this snippet won't receive it.
>>>>
>>>> And please let me know if I am doing something wrong.
>>>>
>>>> Any help greatly appreciated.
>>>>
>>>> Jimmie
>>>>
>>>>
>>>>
>>
>
June 11, 2015
Re: [Pharo-users] ZnClient and percent characters
by Jimmie Houchin
Thanks, that worked great.
That's why I said I am not an expert. I can pull up a page or two. But
that doesn't mean I understand all the legal minutiae involved in what
is and what isn't legal in an URI or query or path or ...
That is why I noted my requirements regardless of legal minutiae and
right or wrong.
Thanks for a practical solution.
Jimmie
On 06/10/2015 06:22 PM, PBKResearch wrote:
>
> There is a simpler way than Norbertâs suggestion. Find the class
> ZnResourceMetaUtils (in the package Zinc-Resource-Meta-Core). Locate
> the class side method #queryKeyValueSafeSet. Remove the comma from the
> string. With this change your âGoogleâ example generates the query
> line with the â%2Câ encoding of the commas.
>
> Of course, with this change a comma in the value field of a query will
> always be encoded. It is not clear to me whether this is correcting an
> error in Zinc, or just a hack to solve your problem â earlier posts
> here endorse both views. No doubt Sven is the person to sort this out.
> Meanwhile, this will enable you to get moving.
>
> Hope this helps
>
> Peter Kenny
>
> *From:*Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] *On
> Behalf Of *Norbert Hartl
> *Sent:* 10 June 2015 23:56
> *To:* Pharo users users
> *Subject:* Re: [Pharo-users] ZnClient and percent characters
>
> Just to clarify:
>
> "Characters in the "reserved" set are not reserved in all contexts.
>
> The set of characters actually reserved within any given URI
> component is defined by that component. In general, a character is
> reserved if the semantics of the URI changes if the character is
> replaced with its escaped US-ASCII encoding."
> If I were you I'd subclass ZnUrl and implement
> #encodeQuery:on:
> on that class. You could have an extension method in ZnResourceMetaUtils that returns the character set you need to have encoded. In ZnClient you just set your ZnUrl derived class object as #url:
> Cannot think of anything better for a quick resolve of your problem.
> Norbert
>
> Am 11.06.2015 um 00:26 schrieb Jimmie Houchin <jlhouchin(a)gmail.com
> <mailto:jlhouchin@gmail.com>>:
>
> I am not an expert on URIs or encoding. However, this is a
> requirement of the API I am using and I am required to submit an
> encoded URI with %2C and no commas.
>
> As far as commas needing to be escaped, it seems from other
> sources that they should be.
>
> From https://www.ietf.org/rfc/rfc2396.txt
>
> The plus "+", dollar "$", and comma "," characters have been added to
>
> those in the "reserved" set, since they are treated as reserved
>
> within the query component.
>
>
>
> States that commas are reserved within the query component.
>
>
>
> http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded
>
>
>
> Regardless of what is or is not required, I do need the ability to have a query string with commas encoded as %2C in order to satisfy and use the API which states.
>
>
>
> fields: Optional An URL encoded (%2C) comma separated list of instrument fields that are to be returned in the response. The instrument field will be returned regardless of the input to this query parameter. Please see the Response Parameters section below for a list of valid values.
>
>
>
> Which will look like this or something similar.
>
>
>
> fields=displayName%2Cinstrument%2Cpip
>
>
>
>
>
> Thanks.
>
>
>
> Jimmie
>
>
>
> On 06/10/2015 03:27 PM, Norbert Hartl wrote:
>
> That's because the comma does not need to be escaped in the query part of the uri.
>
>
>
> Norbert
>
>
>
> Am 10.06.2015 um 22:00 schrieb Jimmie Houchin<jlhouchin(a)gmail.com> <mailto:jlhouchin@gmail.com>:
>
>
>
> On 06/10/2015 10:32 AM, Sven Van Caekenberghe wrote:
>
> On 10 Jun 2015, at 17:24, David<stormbyte(a)gmail.com> <mailto:stormbyte@gmail.com> wrote:
>
>
>
> El Wed, 10 Jun 2015 10:14:37 -0500
>
> Jimmie Houchin<jlhouchin(a)gmail.com> <mailto:jlhouchin@gmail.com>
>
> escribió:
>
> Hello,
>
>
>
> I am attempting to use ZnClient to request data. The request requires
>
> a %2C (comma) delimited string as part of the query. Below is a
>
> snippet.
>
>
>
> znClient
>
> addPath: '/v1/instruments';
>
> queryAt: 'fields' putAll: 'displayName%2Cinstrument%2Cpip';
>
> get ;
>
> contents)
>
>
>
> The string 'displayName%2Cinstrument%2Cpip'
>
> is being converted to 'displayName%252Cinstrument%252Cpip'
>
> which causes the request to fail.
>
>
>
> The query needs to be
>
> fields=displayName%2Cinstrument%2Cpip
>
>
>
> I have not found how to do this correctly.
>
> Any help greatly appreciated.
>
>
>
> Thanks.
>
>
>
> Jimmie
>
>
>
>
>
> Maybe a silly thing, but since %2C = , ... Did you tried already to
>
> make itself encode that? Like
>
> znClient
>
> addPath: '/v1/instruments';
>
> queryAt: 'fields' putAll: 'displayName,instrument,pip';
>
> get ;
>
> contents)
>
>
>
> I suspect it is using encoding internally, that is why % is also
>
> encoded if you try to put it.
>
>
>
> I hope that works
>
> Not silly and no need to suspect, but absolutely correct !
>
>
>
> Sven
>
> My apologies for not having full disclosure.
>
>
>
> Pharo 4, new image, freshly installed Zinc stable version.
>
> Xubuntu 15.04
>
>
>
>
>
>
>
> That is what I thought would happen and what I tried first. But it is not being encoded from what I can find.
>
>
>
> Inspect this in a workspace/playground.
>
>
>
> ZnClient new
>
> https;
>
> host: 'google.com <http://google.com>';
>
> addPath: '/commaTest';
>
> queryAt: 'fields' put: 'displayName,instrument,pip';
>
> yourself
>
>
>
> View the request / requestLine / uri. The commas are still present in the URI.
>
> So I tried encoding myself and get the other error.
>
>
>
> Of course Google won't understand this and in this snippet won't receive it.
>
>
>
> And please let me know if I am doing something wrong.
>
>
>
> Any help greatly appreciated.
>
>
>
> Jimmie
>
>
>
>
>
>
>
>
>
June 11, 2015
Re: [Pharo-users] ZnClient and percent characters
by PBKResearch
There is a simpler way than Norbertâs suggestion. Find the class ZnResourceMetaUtils (in the package Zinc-Resource-Meta-Core). Locate the class side method #queryKeyValueSafeSet. Remove the comma from the string. With this change your âGoogleâ example generates the query line with the â%2Câ encoding of the commas.
Of course, with this change a comma in the value field of a query will always be encoded. It is not clear to me whether this is correcting an error in Zinc, or just a hack to solve your problem â earlier posts here endorse both views. No doubt Sven is the person to sort this out. Meanwhile, this will enable you to get moving.
Hope this helps
Peter Kenny
From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Norbert Hartl
Sent: 10 June 2015 23:56
To: Pharo users users
Subject: Re: [Pharo-users] ZnClient and percent characters
Just to clarify:
"Characters in the "reserved" set are not reserved in all contexts.
The set of characters actually reserved within any given URI
component is defined by that component. In general, a character is
reserved if the semantics of the URI changes if the character is
replaced with its escaped US-ASCII encoding."
If I were you I'd subclass ZnUrl and implement
#encodeQuery:on:
on that class. You could have an extension method in ZnResourceMetaUtils that returns the character set you need to have encoded. In ZnClient you just set your ZnUrl derived class object as #url:
Cannot think of anything better for a quick resolve of your problem.
Norbert
Am 11.06.2015 um 00:26 schrieb Jimmie Houchin <jlhouchin(a)gmail.com <mailto:jlhouchin@gmail.com> >:
I am not an expert on URIs or encoding. However, this is a requirement of the API I am using and I am required to submit an encoded URI with %2C and no commas.
As far as commas needing to be escaped, it seems from other sources that they should be.
>From https://www.ietf.org/rfc/rfc2396.txt
The plus "+", dollar "$", and comma "," characters have been added to
those in the "reserved" set, since they are treated as reserved
within the query component.
States that commas are reserved within the query component.
http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded
Regardless of what is or is not required, I do need the ability to have a query string with commas encoded as %2C in order to satisfy and use the API which states.
fields: Optional An URL encoded (%2C) comma separated list of instrument fields that are to be returned in the response. The instrument field will be returned regardless of the input to this query parameter. Please see the Response Parameters section below for a list of valid values.
Which will look like this or something similar.
fields=displayName%2Cinstrument%2Cpip
Thanks.
Jimmie
On 06/10/2015 03:27 PM, Norbert Hartl wrote:
That's because the comma does not need to be escaped in the query part of the uri.
Norbert
Am 10.06.2015 um 22:00 schrieb Jimmie Houchin <mailto:jlhouchin@gmail.com> <jlhouchin(a)gmail.com>:
On 06/10/2015 10:32 AM, Sven Van Caekenberghe wrote:
On 10 Jun 2015, at 17:24, David <mailto:stormbyte@gmail.com> <stormbyte(a)gmail.com> wrote:
El Wed, 10 Jun 2015 10:14:37 -0500
Jimmie Houchin <mailto:jlhouchin@gmail.com> <jlhouchin(a)gmail.com>
escribió:
Hello,
I am attempting to use ZnClient to request data. The request requires
a %2C (comma) delimited string as part of the query. Below is a
snippet.
znClient
addPath: '/v1/instruments';
queryAt: 'fields' putAll: 'displayName%2Cinstrument%2Cpip';
get ;
contents)
The string 'displayName%2Cinstrument%2Cpip'
is being converted to 'displayName%252Cinstrument%252Cpip'
which causes the request to fail.
The query needs to be
fields=displayName%2Cinstrument%2Cpip
I have not found how to do this correctly.
Any help greatly appreciated.
Thanks.
Jimmie
Maybe a silly thing, but since %2C = , ... Did you tried already to
make itself encode that? Like
znClient
addPath: '/v1/instruments';
queryAt: 'fields' putAll: 'displayName,instrument,pip';
get ;
contents)
I suspect it is using encoding internally, that is why % is also
encoded if you try to put it.
I hope that works
Not silly and no need to suspect, but absolutely correct !
Sven
My apologies for not having full disclosure.
Pharo 4, new image, freshly installed Zinc stable version.
Xubuntu 15.04
That is what I thought would happen and what I tried first. But it is not being encoded from what I can find.
Inspect this in a workspace/playground.
ZnClient new
https;
host: 'google.com <http://google.com> ';
addPath: '/commaTest';
queryAt: 'fields' put: 'displayName,instrument,pip';
yourself
View the request / requestLine / uri. The commas are still present in the URI.
So I tried encoding myself and get the other error.
Of course Google won't understand this and in this snippet won't receive it.
And please let me know if I am doing something wrong.
Any help greatly appreciated.
Jimmie
June 10, 2015
Re: [Pharo-users] ZnClient and percent characters
by Norbert Hartl
Just to clarify:
"Characters in the "reserved" set are not reserved in all contexts.
The set of characters actually reserved within any given URI
component is defined by that component. In general, a character is
reserved if the semantics of the URI changes if the character is
replaced with its escaped US-ASCII encoding."
If I were you I'd subclass ZnUrl and implement
#encodeQuery:on:
on that class. You could have an extension method in ZnResourceMetaUtils that returns the character set you need to have encoded. In ZnClient you just set your ZnUrl derived class object as #url:
Cannot think of anything better for a quick resolve of your problem.
Norbert
> Am 11.06.2015 um 00:26 schrieb Jimmie Houchin <jlhouchin(a)gmail.com>:
>
> I am not an expert on URIs or encoding. However, this is a requirement of the API I am using and I am required to submit an encoded URI with %2C and no commas.
>
> As far as commas needing to be escaped, it seems from other sources that they should be.
>
> From https://www.ietf.org/rfc/rfc2396.txt <https://www.ietf.org/rfc/rfc2396.txt>
> The plus "+", dollar "$", and comma "," characters have been added to
> those in the "reserved" set, since they are treated as reserved
> within the query component.
>
> States that commas are reserved within the query component.
>
> http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded <http://stackoverflow.com/questions/8828702/why-is-the-comma-url-encoded>
>
> Regardless of what is or is not required, I do need the ability to have a query string with commas encoded as %2C in order to satisfy and use the API which states.
>
> fields: Optional An URL encoded (%2C) comma separated list of instrument fields that are to be returned in the response. The instrument field will be returned regardless of the input to this query parameter. Please see the Response Parameters section below for a list of valid values.
>
> Which will look like this or something similar.
>
> fields=displayName%2Cinstrument%2Cpip
>
>
> Thanks.
>
> Jimmie
>
> On 06/10/2015 03:27 PM, Norbert Hartl wrote:
>> That's because the comma does not need to be escaped in the query part of the uri.
>>
>> Norbert
>>
>>> Am 10.06.2015 um 22:00 schrieb Jimmie Houchin <jlhouchin(a)gmail.com> <mailto:jlhouchin@gmail.com>:
>>>
>>> On 06/10/2015 10:32 AM, Sven Van Caekenberghe wrote:
>>>>> On 10 Jun 2015, at 17:24, David <stormbyte(a)gmail.com> <mailto:stormbyte@gmail.com> wrote:
>>>>>
>>>>> El Wed, 10 Jun 2015 10:14:37 -0500
>>>>> Jimmie Houchin <jlhouchin(a)gmail.com> <mailto:jlhouchin@gmail.com>
>>>>> escribió:
>>>>>> Hello,
>>>>>>
>>>>>> I am attempting to use ZnClient to request data. The request requires
>>>>>> a %2C (comma) delimited string as part of the query. Below is a
>>>>>> snippet.
>>>>>>
>>>>>> znClient
>>>>>> addPath: '/v1/instruments';
>>>>>> queryAt: 'fields' putAll: 'displayName%2Cinstrument%2Cpip';
>>>>>> get ;
>>>>>> contents)
>>>>>>
>>>>>> The string 'displayName%2Cinstrument%2Cpip'
>>>>>> is being converted to 'displayName%252Cinstrument%252Cpip'
>>>>>> which causes the request to fail.
>>>>>>
>>>>>> The query needs to be
>>>>>> fields=displayName%2Cinstrument%2Cpip
>>>>>>
>>>>>> I have not found how to do this correctly.
>>>>>> Any help greatly appreciated.
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> Jimmie
>>>>>>
>>>>>>
>>>>> Maybe a silly thing, but since %2C = , ... Did you tried already to
>>>>> make itself encode that? Like
>>>>> znClient
>>>>> addPath: '/v1/instruments';
>>>>> queryAt: 'fields' putAll: 'displayName,instrument,pip';
>>>>> get ;
>>>>> contents)
>>>>>
>>>>> I suspect it is using encoding internally, that is why % is also
>>>>> encoded if you try to put it.
>>>>>
>>>>> I hope that works
>>>> Not silly and no need to suspect, but absolutely correct !
>>>>
>>>> Sven
>>> My apologies for not having full disclosure.
>>>
>>> Pharo 4, new image, freshly installed Zinc stable version.
>>> Xubuntu 15.04
>>>
>>>
>>>
>>> That is what I thought would happen and what I tried first. But it is not being encoded from what I can find.
>>>
>>> Inspect this in a workspace/playground.
>>>
>>> ZnClient new
>>> https;
>>> host: 'google.com';
>>> addPath: '/commaTest';
>>> queryAt: 'fields' put: 'displayName,instrument,pip';
>>> yourself
>>>
>>> View the request / requestLine / uri. The commas are still present in the URI.
>>> So I tried encoding myself and get the other error.
>>>
>>> Of course Google won't understand this and in this snippet won't receive it.
>>>
>>> And please let me know if I am doing something wrong.
>>>
>>> Any help greatly appreciated.
>>>
>>> Jimmie
>>>
>>>
>>>
>>
>
June 10, 2015