Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String.Join return × 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 ×?

like image 523
markzzz Avatar asked Jan 22 '26 22:01

markzzz


2 Answers

Your join is putting the text &times into the string which is being encoded into x because &times is a html named special character

try this,

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 string to HTML- encoded 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));
like image 40
Jignesh Thakker Avatar answered Jan 25 '26 11:01

Jignesh Thakker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!