Assuming applicationForm is a string that you are reading from some UTF8 text file. It will be UTF16 / Unicode , regardless of the encoding of the source file. The conversion occurred when you uploaded the file to a string.
Your code will encode the applicationForm string into a MemoryStream of UTF8 bytes.
This may or may not be correct depending on what you want to do with it.
. String strings are always UTF16 or Unicode . When Strings converted to files, streams, or byte[] , they can be encoded in different ways. 1 byte is not enough to store all the different characters used in all languages, so more complex strings must be encoded, so a single charachter can be represented by more than one byte, sometimes or always depending on the encoding used.
If you use a simple encoding such as ASCII , one hacker will always contain one byte, but the data will be limited to the ASCII character ASCII . Converting to "ASCII" from any UTF encoding may lose data if multiple byte characters are used.
For a complete unicode image, go here .
EDIT 1: Preventing additional information about a GenerateApplicationForm component suitable for UTF8 probably be the right choice. If this works, try ASCII or UTF16 . Best of all, refer to the source code of the component or the supplier of the component.
EDIT 2: Definitely UTF8 , then you were right all the time.
source share