How do I compress a string for sending via a GET request?

  • 0
    Hello!
    I need to send in a get-request (through a parameter) a string of the form: 123_78900_44343_4349 _..._ 34343_121 (many numeric codes separated by underscores).
    Can you please tell me, can I somehow compress (reduce) this string, but so that it can be restored on the server?
    JavaScript Anonymous, Jul 20, 2020

  • 3 Answers
  • 0
    Convert codes to a different number system.

    For example, taking 64-bit system [0-9a-zA-Z \ -_] from 78900 we get jgQ .

    If all numbers fall within a certain range, then you can try to abandon underscores and write each number with a fixed number of digits and leading zeros. Then, for example, 123_78900_44343_4349 is converted to 01XjgQaQT13Z
    Anonymous

  • 0
    I need to send in a get-request (via a parameter) a string like this: 123_78900_44343_4349 _..._ 34343_121 (many numeric codes separated by underscores).


    Don't do this. This is an erroneous decision that will breed problems.

    Easy solution - use POST request.
    Rhys Odom

  • 0
    zip + base64 (or maybe UUE will give more compression)

    but after base64 it may turn out that the size gets even bigger.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!