source: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/_lod_utils.bash@ 35991

Last change on this file since 35991 was 34735, checked in by davidb, 3 years ago

Made separate file so bash function be used in multiple scripts

File size: 703 bytes
Line 
1
2# How to deal with 2 entrants specifying 2 songs ???
3# Could be an issue with SPARQL: e.g., see discussion
4
5# "Constructing containers and collections"
6# https://www.w3.org/2009/sparql/wiki/Feature:Constructing_containers_and_collections
7
8
9# Adapted from:
10# https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command
11
12rawurlencode() {
13 local string="${1}"
14 local strlen=${#string}
15 local encoded=""
16 local pos c o
17
18 for (( pos=0 ; pos<strlen ; pos++ )); do
19 c=${string:$pos:1}
20 case "$c" in
21 [-_.~a-zA-Z0-9\(\)] ) o="${c}"
22 ;;
23
24 " " ) o="+"
25 ;;
26
27 * ) printf -v o '%%%02X' "'$c"
28 esac
29 encoded+="${o}"
30 done
31 echo "${encoded}"
32}
Note: See TracBrowser for help on using the repository browser.