* Re: rfc2396 url encoding
[not found] ` <1051106194911.ZM32000@candle.brasslantern.com>
@ 2007-04-25 3:47 ` Clint Adams
2007-04-25 6:22 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Clint Adams @ 2007-04-25 3:47 UTC (permalink / raw)
To: zsh-workers
On Sun, Nov 06, 2005 at 07:49:11PM +0000, Bart Schaefer wrote:
> urlencode() {
> setopt localoptions extendedglob
> input=( ${(s::)1} )
> print ${(j::)input/(#b)([^A-Za-z0-9_.!~*\'\(\)-])/%$(([##16]#match))}
> }
This changed behavior in that ó (UTF-8) becomes %F3 instead of %C3%B3 .
Thoughts?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: rfc2396 url encoding
2007-04-25 3:47 ` rfc2396 url encoding Clint Adams
@ 2007-04-25 6:22 ` Bart Schaefer
2007-04-25 9:21 ` Peter Stephenson
2007-04-25 11:28 ` Clint Adams
0 siblings, 2 replies; 4+ messages in thread
From: Bart Schaefer @ 2007-04-25 6:22 UTC (permalink / raw)
To: zsh-workers
On Apr 24, 11:47pm, Clint Adams wrote:
}
} > input=( ${(s::)1} )
} > print ${(j::)input/(#b)([^A-Za-z0-9_.!~*\'\(\)-])/%$(([##16]#match))}
}
} This changed behavior in that ó (UTF-8) becomes %F3 instead of %C3%B3 .
} Thoughts?
(Is that actually wrong? When I cut and paste from your email message,
there's only one byte at ó.)
I see the point, though, I think. (s::) is now splitting between wide
characters rather than between raw bytes.
What happens if you simply unsetopt multibyte within the function?
urlencode() {
setopt localoptions extendedglob nomultibyte
input=( ${(s::)1} )
print ${(j::)input/(#b)([^A-Za-z0-9_.!~*\'\(\)-])/%$(([##16]#match))}
}
If that doesn't work, we'll have to come up with some way to force $1
to be re-interpreted as a raw byte string rather than a wide character
string before splitting it up.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: rfc2396 url encoding
2007-04-25 6:22 ` Bart Schaefer
@ 2007-04-25 9:21 ` Peter Stephenson
2007-04-25 11:28 ` Clint Adams
1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2007-04-25 9:21 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> What happens if you simply unsetopt multibyte within the function?
>
> urlencode() {
> setopt localoptions extendedglob nomultibyte
> input=( ${(s::)1} )
> print ${(j::)input/(#b)([^A-Za-z0-9_.!~*\'\(\)-])/%$(([##16]#match))}
> }
That's supposed to work and is the approved method of treating strings
as individual bytes. I haven't tried it since the last thing I need at
the moment is being drawn into another bug fix.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: rfc2396 url encoding
2007-04-25 6:22 ` Bart Schaefer
2007-04-25 9:21 ` Peter Stephenson
@ 2007-04-25 11:28 ` Clint Adams
1 sibling, 0 replies; 4+ messages in thread
From: Clint Adams @ 2007-04-25 11:28 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-workers
> (Is that actually wrong? When I cut and paste from your email message,
> there's only one byte at ó.)
Your mailer is likely converting my UTF-8 to Latin-1 or Latin-9.
> What happens if you simply unsetopt multibyte within the function?
That does the trick.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-04-25 11:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20051106185713.GA11612@scowler.net>
[not found] ` <1051106194911.ZM32000@candle.brasslantern.com>
2007-04-25 3:47 ` rfc2396 url encoding Clint Adams
2007-04-25 6:22 ` Bart Schaefer
2007-04-25 9:21 ` Peter Stephenson
2007-04-25 11:28 ` Clint Adams
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).