|
@@ -390,6 +390,18 @@ nljoin() {
|
390
|
390
|
| fixnl -c
|
391
|
391
|
}
|
392
|
392
|
|
|
393
|
+urle() {
|
|
394
|
+ #
|
|
395
|
+ # Encode or decode (if $1 is '-d') message on stdin as URL encode
|
|
396
|
+ #
|
|
397
|
+ local fn=quote
|
|
398
|
+ case $1 in
|
|
399
|
+ -d) fn=unquote ;;
|
|
400
|
+ -*) echo 'usage: urle [-d] <text' >&2; return 2 ;;
|
|
401
|
+ esac
|
|
402
|
+ python3 -c "import sys; from urllib.parse import $fn; print($fn(sys.stdin.read()));"
|
|
403
|
+}
|
|
404
|
+
|
393
|
405
|
qpr() {
|
394
|
406
|
#
|
395
|
407
|
# Encode or decode (if $1 is '-d') message on stdin as Quoted Printable
|