So the scenario is this: The user uploads the file, my code turns this file into an array of bytes, and the array is passed to the external API. And it works great.
The problem is that this file contains special characters, such as Γ¦, ΓΈ, Γ₯, and when byte [] is converted to characters again, these characters are replaced with "?".
public void UploadFile(HttpPostedFileBase file){ var binary = new byte[file.ContentLength]; file.InputStream.Read(binary, 0, file.ContentLength; var result = API.UploadDocument(binary);
Is it possible to add some encoding information to a byte array or InputStream, or is it API dependent to make sure the text is correctly encoded when converting byte [] back to characters?
source share