drewnoakes / fix-decoder

Unravels FIX messages into human readable tables
https://drewnoakes.com/fix-decoder/
80 stars 34 forks source link

Allow sending message via encoded URL hash fragment #5

Closed drewnoakes closed 11 years ago

drewnoakes commented 11 years ago

It can be convenient to send a message to someone else for review. The page's hash fragment should be updated (provided it's not too long) with an encoded version of the message text. Possibly use Base64 encoding.

drewnoakes commented 11 years ago

Complete. I may look at this again later to see if there's a more compact encoding than base 64 that still forms a valid URL.

whatthefrog commented 11 years ago

What about standart URL encoding ?

escape('8=FIX.4.2|9=179|35=AE|56=LSEHub|49=BROKE...|43=N|570=N|150=0|48=GB0007188757|10=017|');
293 chars "8%3DFIX.4.2%7C9%3D179%7C35%3DAE%7C56%3DLSEHub%7C49%3DBROKERX%7C128%3DLSETR%7C34%3D2175%7C52%3D20120126-15%3A15%3A54%7C918%3DGBP%7C31%3D89.0000000%7C64%3D20120126%7C828%3D1%7C60%3D20120126-13%3A32%3A49%7C32%3D6%7C22%3D4%7C571%3D124%7C43%3DN%7C570%3DN%7C150%3D0%7C48%3DGB0007188757%7C10%3D017%7C"

encodeURI('8=FIX.4.2|9=179|35=AE|56=LSEHub|49=BR...|43=N|570=N|150=0|48=GB0007188757|10=017|'); 243 chars "8=FIX.4.2%7C9=179%7C35=AE%7C56=LSEHub%7C49=BROKERX%7C128=LSETR%7C34=2175%7C52=20120126-15:15:54%7C918=GBP%7C31=89.0000000%7C64=20120126%7C828=1%7C60=20120126-13:32:49%7C32=6%7C22=4%7C571=124%7C43=N%7C570=N%7C150=0%7C48=GB0007188757%7C10=017%7C"

btoa('8=FIX.4.2|9=179|35=AE|56=LSEHub|49=BROKERX...|43=N|570=N|150=0|48=GB0007188757|10=017|');
269 chars "OD1GSVguNC4yfDk9MTc5fDM1PUFFfDU2PUxTRUh1Ynw0OT1CUk9LRVJYfDEyOD1MU0VUUnwzND0yMTc1fDUyPTIwMTIwMTI2LTE1OjE1OjU0fDkxOD1HQlB8MzE9ODkuMDAwMDAwMHw2ND0yMDEyMDEyNnw4Mjg9MXw2MD0yMDEyMDEyNi0xMzozMjo0OXwzMj02fDIyPTR8NTcxPTEyNHw0Mz1OfDU3MD1OfDE1MD0wfDQ4PUdCMDAwNzE4ODc1N3wxMD0wMTd8"

drewnoakes commented 11 years ago

@whatthefrog this is an interesting idea. I like the opaque nature of the base 64 encoding -- URI encoding makes me try to read what's there. It seems URI encoding may be 10% smaller, at least for the message you demonstrate.

whatthefrog commented 11 years ago

base64 is well known offender of increasing data size (about 33% if I remember, http://stackoverflow.com/a/4715499)

I personnaly like to see what's on a link, sad that the | char is uriencoded with 3 chars ... as It would make the url much more readable

well, up to you ...