fork download
  1. BEGIN{
  2. str = "google.com/search?q=%60Abdu%27l-Bah%C3%A1" # google.com/search?q=`Abdu'l-Bahá
  3. printf("%s\n",str)
  4. len=length(str)
  5. for (i=1;i<=len;i++) {
  6. if ( substr(str,i,1) == "%") {
  7. L = substr(str,1,i-1) # chars to left of "%"
  8. M = substr(str,i+1,2) # 2 chars to right of "%"
  9. R = substr(str,i+3) # chars to right of "%xx"
  10. str = sprintf("%s%c%s",L,hex2dec(M),R)
  11. }
  12. }
  13. printf("%s\n",str)
  14. exit(0)
  15. }
  16. function hex2dec(s, num) {
  17. num = index("0123456789ABCDEF",toupper(substr(s,length(s)))) - 1
  18. sub(/.$/,"",s)
  19. return num + (length(s) ? 16*hex2dec(s) : 0)
  20. }
  21.  
Success #stdin #stdout 0s 5876KB
stdin
Standard input is empty
stdout
google.com/search?q=%60Abdu%27l-Bah%C3%A1
google.com/search?q=`Abdu'l-Bahá