1

How can I convert/export binary data (for example binary files like excel- or word-documents) into a string (into text format) in .NET, so that it can be imported somewhere else (e.g. in another application, which was written in another programming language (not in .NET)). Are there universal concepts to achieve this goal ?

2
  • You should look at Ascii85: en.wikipedia.org/wiki/Ascii85. Any such solution, however, needs support in both applications, so if you want to pass that string to another application that already exists, I would look at what that application supports. Commented Jun 29, 2010 at 14:49
  • Depending on your target client there are lot of ways to do it especially if you want to optimize as you know witch character (if any) can't be transported. But as jon said, base64 is the most common one since it is used in all mail systems (MIME also define quoted printable but for purely binary data it's notably worse than base64) Commented Jun 29, 2010 at 16:00

1 Answer 1

4

The most common form is to use Base64 encoding between binary and text. .NET supports this with Convert.ToBase64String and Convert.FromBase64String.

Base64 is widely supported, and is a common way of encoding binary data in pure ASCII, encoding 3 bytes into 4 characters (repeatedly).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.