[rb-general] BUILD_PATH_PREFIX_MAP code examples and test cases
danielsh at apache.org
Tue Jan 31 10:35:13 CET 2017
Ximin Luo wrote on Tue, Jan 31, 2017 at 08:57:00 +0000:
> Daniel Shahaf:
> > [..]
> > I also agree that all implementations should be required to behave the
> > same way on strings that can't be produced by the encoder, such as '%%+'
> > or '%x'. However, my first preference would be to specify that
> > consumers <rfc2219>must</rfc2219> reject such strings with an error
> > message. That is: I would require consumers to be strict in what they
> > accept.
> I had left this out originally, because the cleanest way I could think of, to implement this in a high-level language, was to regex-match for /%[^pec]|%$/ and I was trying to avoid the need for regexes. But I suppose a single check isn't too bad.
> If you can think of a better way to do it, let me know.
You could use negative lookahead (/%(?![pec])/), or .split():
for x in os.getenv(…).split('%')[1:]:
if not (x != '' and x in 'pec'):
> > Have we run this encoding past windows folks? The character '%' is
> > special to batch scripts, so it would be good to ensure windows build
> > scripts can handle the encoding scheme we're discussing here. (Or if
> > they can't, to use «\» or «@» or whatever else instead of «%».) We
> > don't have to check this right now, but we should check this before
> > releasing v1.0 of the spec.
> > [..]
> It looks like you can write %% instead, if doing it manually. Or use EnableDelayedExpansion if you need to do anything more complex with % characters.
I don't fully follow that link, but I take it the bottom line is that
% can be used. Thanks for checking!
More information about the rb-general