I'm making an HTTP POST request with this:
byte[] postBuffer = Encoding.UTF8.GetBytes(postStr);
So far, this seems working fine but I'm not sure if this will always work, because Encoding.UTF8 means UTF8 WITH BOM. When I create local files with StreamWriter
, always use the default encoding which is the same as new UTF8Encoding(false) in order to write WITHOUT BOM. So wonder if the same is true for calling GetBytes()
method too.
In this case, isn't there any difference between above and below line?
byte[] postBuffer = new UTF8Encoding().GetBytes(postStr);
I tested several times myself but still not sure 100%, so asking here.