I'm trying to send multiple GZipped files in the same request, with a string delimiter, which are then supposed to be read by GZip Stream individually.
The problem I'm having is that I can either split the string (using UTF-8 encoding) or decompress the GZip (when using Unicode), but I need to be able to do both. It has to be something simple that I'm overlooking.
In short:
Encoding.UTF8.GetBytes(Encoding.UTF8.GetString(byteArray))
returns a different byte array from the original. The same happens with ASCII.
Encoding.Unicode.GetBytes(Encoding.Unicode.GetString(byteArray))
returns the same byte array as the original, but for some reason I'm unable to split the received data using my delimiter (for example: Encoding.Unicode.GetString(byteArray).Split(new string[] { delimiter }, StringSplitOptions.None)
doesn't find the delimiter and returns a string array with one element, the full string). Each file is 15-20KB, so I can't paste them here.
What am I missing?
I can do it with BitConverter and looking for the delimiter as a HEX value, but there has to be a better way.
I'm not listening for requests, but I make an API request from the app (the server is vanilla PHP7), and get the files in the response. Using Unity's WWW class.