4

My requirement is to encode data and send it across network via HTTP, but I am stuck trying to choose the best encoding technique. Which of the three above is best? Is there anything better?

The criteria for "best" should be small size and fast encoding/decoding.

james.garriss
  • 12,959
  • 7
  • 83
  • 96
Charzhard
  • 783
  • 1
  • 7
  • 19
  • What are your criteria for "best"? – Sirko Jul 11 '13 at 09:24
  • I have updated the criteria for the best – Charzhard Jul 11 '13 at 09:29
  • yEnc, Base64 and Uuencode are not compression algorithms. They are used to send binary data with text only protocols such as POP3 and SMTP. If you are not facing such situation (limited to text), then you could simply zip your data. Are transmitting images, PDF documents... What protocol are you using? – Tarik Jul 13 '13 at 06:17
  • @Tarik i'm sending the data through http protocol, as well as i'm sending images, pdf, audio, video all type of documents – Charzhard Jul 14 '13 at 02:45
  • [escapeless](https://github.com/kosarev/escapeless) may be a good alternative to yEnc due to its predictable overhead. – Ivan Kosarev Jun 03 '19 at 17:57

1 Answers1

1

yEnc has less overhead but has other problems mentioned here http://en.wikipedia.org/wiki/YEnc#Criticisms. What is "best" depends on the criteria you might have and how you plan to send data over the network. Are you using a web service, email or other means. You need to provide more details.

Edit: Since you are uploading data via HTTP, you do not need to use any of Base64, yEnc or Uuencode. You just use the standard http file upload built in facility in both browser and web server. See this question as a reference: How does HTTP file upload work? Also this reference: http://www.hanselman.com/blog/ABackToBasicsCaseStudyImplementingHTTPFileUploadWithASPNETMVCIncludingTestsAndMocks.aspx

Community
  • 1
  • 1
Tarik
  • 10,810
  • 2
  • 26
  • 40
  • I'm getting the data from ui and i'm encoding and storing it in a document management system, i have edited the question for your convenience – Charzhard Jul 11 '13 at 09:34
  • I have read the reference but the case is i receive the documents in backend c++ engine, the document management system can be in any data center, so i'm encoding and sending it via poco http library, it doesn't seem to encode the documents that i send that's why i have to encode the documents – Charzhard Jul 14 '13 at 12:47
  • I think it would help further if you mentioned the document management system that you use. The fact that you use C++ on the back end should not affect the capability to upload without encoding assuming you have a HTTP server. – Tarik Jul 14 '13 at 14:43
  • I'am uploading the documents to alfresco – Charzhard Jul 15 '13 at 04:24
  • I found some code here: http://forums.alfresco.com/forum/developer-discussions/other-apis/uploading-file-alfresco-repository-using-alfrescorest-api that uploads a file to alfresco using the restful API. It's in Java though. – Tarik Jul 15 '13 at 05:41
  • The link was not useful, and the subject of the question is encoding, all i need is a good encoding technique – Charzhard Jul 16 '13 at 06:51
  • If you do not face compatibility issues with yEnc, then since it has the least overhead, I would recommend using it. If possible, you could zip, encode, upload and on the server side, decode and unzip. I really do not see any other critria other than overhead that would determine the best choice. – Tarik Jul 16 '13 at 07:09
  • It seems the best choice for me, i will take it as my answer – Charzhard Jul 16 '13 at 07:18