0

I want to send a string of text that can contain special chars via a URL. (The string might contain chars that are not suitable to send as a URL.)

To do this do i want to scramble the string to something that is safe to send. Then on the receiving end i intend to unscramble the string and get back the original string

Example:

  1. string = "this is a complicated string åäö 123435 !"##¤%¤&%/ /// &&&<> ## www.aftonbladet.com \ ? i wonder if this will work... and so on..."

  2. Using some form of function to scramble it to: laskjdkjlasdklajsdfkjsald (example)

  3. Then, send it via a URL to a service the_url = http://www.myurl.com/awesome?laskjdkjlasdklajsdfkjsald response = requests.get(the_url)

  4. In the service will i unscramble the payload back to the original

I do NOT want to import special libraries for this that is not already included in python3 standard libs.

This is not to make it secure and uncrackable, it is just to make it easily transmittable.

I do NOT know exactly what special chars that can exist in the string from the beginning.

I can not be the first one having this problem, who will be first at linking this question to a existing answer ? :D

Any suggestions?

  • There's an official solution to that: [URL encoding](https://en.wikipedia.org/wiki/Percent-encoding). – deceze Aug 25 '20 at 12:36
  • Solved by using a combination of the following links: https://stackoverflow.com/questions/3470546/python-base64-data-decode https://stackabuse.com/encoding-and-decoding-base64-strings-in-python/ https://stackoverflow.com/questions/1374753/passing-base64-encoded-strings-in-url – beardswitcher Aug 25 '20 at 13:54

0 Answers0