Skip to content

Instantly share code, notes, and snippets.

@manuel-rubio
Created March 20, 2013 15:06
Show Gist options
  • Save manuel-rubio/5205413 to your computer and use it in GitHub Desktop.
Save manuel-rubio/5205413 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 'text to encode'"
exit 0
fi
echo "$1" | perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg'
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment