Re: document( URI ) with accented chars fails

"Alexandre Hoïde [email protected]" <[email protected]>
Newsgroups gmane.text.xml.xsl.general.mulberrytech
Message-ID <[email protected]>
On Wed, Nov 18, 2020 at 12:16:01PM -0000, Martynas Jusevičius [email protected] wrote:
> We use this in bash scripts:
> 
> urlencode()
> {
>     python -c 'import urllib, sys; print urllib.quote(sys.argv[1] if
> len(sys.argv) > 1 else sys.stdin.read()[0:-1])' "$1"
> }

  Hello and thanks for the alternative solution Martynas !

  Using [email protected] and [email protected] I had to addapt
your function like this:

~~~{bash script}
urlencode()
{
  python3 -c 'from urllib.parse import quote, sys; print (quote(sys.argv[1]) if len(sys.argv) > 1 else sys.stdin.read()[0:-1])' "$1"
}

Best regards,
Alexandre Hoïde
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/3329386
or by email: [email protected]
--~--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.