07/10/2013, 10:51
(Modification du message : 07/10/2013, 16:37 par MenzAgitat.)
Ce bout de code formate une chaîne pour pouvoir l'utiliser dans une url.
Ce code est extrait de Acronym Fetcher fait par MenzAgitat
Source modifiable
Ce code est extrait de Acronym Fetcher fait par MenzAgitat
tcl
proc ::urlencode {data} {
return [::tcl::string::map {
" " "%20" "\"" "%22" "#" "%23" "$" "%24" "%" "%25"
"&" "%26" "'" "%27" "\(" "%28" "\)" "%29" "*" "%2A"
"+" "%2B" "," "%2C" "." "%2E" "\/" "%2F" ":" "%3A"
";" "%3B" "<" "%3C" "=" "%3D" ">" "%3E" "?" "%3F"
"@" "%40" "\[" "%5B" "\\" "%5C" "\]" "%5D" "^" "%5E"
"\{" "%7B" "|" "%7C" "\}" "%7D" "~" "%7E" "¡" "%A1"
"¢" "%A2" "£" "%A3" "¤" "%A4" "¥" "%A5" "¦" "%A6"
"§" "%A7" "¨" "%A8" "©" "%A9" "ª" "%AA" "«" "%AB"
"¬" "%AC" "" "%AD" "®" "%AE" "¯" "%AF" "°" "%B0"
"±" "%B1" "²" "%B2" "³" "%B3" "´" "%B4" "µ" "%B5"
"¶" "%B6" "·" "%B7" "¸" "%B8" "¹" "%B9" "º" "%BA"
"»" "%BB" "¼" "%BC" "½" "%BD" "¾" "%BE" "¿" "%BF"
"À" "%C0" "Á" "%C1" "Â" "%C2" "Ã" "%C3" "Ä" "%C4"
"Å" "%C5" "Æ" "%C6" "Ç" "%C7" "È" "%C8" "É" "%C9"
"Ê" "%CA" "Ë" "%CB" "Ì" "%CC" "Í" "%CD" "Î" "%CE"
"Ï" "%CF" "Ð" "%D0" "Ñ" "%D1" "Ò" "%D2" "Ó" "%D3"
"Ô" "%D4" "Õ" "%D5" "Ö" "%D6" "×" "%D7" "Ø" "%D8"
"Ù" "%D9" "Ú" "%DA" "Û" "%DB" "Ü" "%DC" "Ý" "%DD"
"Þ" "%DE" "ß" "%DF" "à" "%E0" "á" "%E1" "â" "%E2"
"ã" "%E3" "ä" "%E4" "å" "%E5" "æ" "%E6" "ç" "%E7"
"è" "%E8" "é" "%E9" "ê" "%EA" "ë" "%EB" "ì" "%EC"
"í" "%ED" "î" "%EE" "ï" "%EF" "ð" "%F0" "ñ" "%F1"
"ò" "%F2" "ó" "%F3" "ô" "%F4" "õ" "%F5" "ö" "%F6"
"÷" "%F7" "ø" "%F8" "ù" "%F9" "ú" "%FA" "û" "%FB"
"ü" "%FC" "ý" "%FD" "þ" "%FE" "ÿ" "%FF"
} $data]
}
Source modifiable