String.Join returns × instead of times?

This is my code:

var signature_parameters = new SortedDictionary<string, string>()
{
    { "client_id", client_id },
    { "timestamp", timestamp },
};

var signature_base_string = string.Join("&", signature_parameters.Select(p => string.Format("{0}={1}", p.Key, p.Value)));
Response.Write(signature_base_string);

which prints client_id=2446782×tamp=1291723521

What is ×?

+3
source share
2 answers

Your connection puts the text ×in a string that is encoded in x, because it ×is html with a special character

+11
source

try it,

var signature_base_string = string.Join("&amp;", signature_parameters.Select(p => string.Format("{0}={1}", p.Key, p.Value)));

Response.Write(signature_base_string);

Or you can use HttpUtility.HtmlEncode to convert a string to an encoded HTML string.

var signature_base_string = string.Join("&", signature_parameters.Select(p => string.Format("{0}={1}", p.Key, p.Value)));
Response.Write(HttpUtility.HtmlEncode(signature_base_string));
+1
source

All Articles