我解决这个问题。
类似:
public string Encode(string text)
{
byte[] myASCIIBytes = UnicodeEncoding.Unicode.GetBytes(text);
byte[] myUTF8Bytes = Encoding.Convert( Encoding.Unicode,UTF8Encoding.UTF8, myASCIIBytes);
return Encoding.Default.GetString(myUTF8Bytes);
}
protected string UrlEncodePost(string value)
{
StringBuilder result = new StringBuilder();
foreach (char symbol in value)
{
if (unreservedChars.IndexOf(symbol) != -1)
{
result.Append(symbol);
}
else
{
result.Append( % + String.Format("{0:X2}", (int)symbol));
}
}
return result.ToString();
}
timeZone = UrlEncodePost(Encode("Central Time (US & Canada)"));
And I updated ComputeHash function in the OAuthBase.cs file.
=>
private string ComputeHash(HashAlgorithm hashAlgorithm, string data) {
if (hashAlgorithm == null) {
throw new ArgumentNullException("hashAlgorithm");
}
if (string.IsNullOrEmpty(data)) {
throw new ArgumentNullException("data");
}
byte[] myBytes = UnicodeEncoding.Unicode.GetBytes(data);
byte[] myUTF8Bytes = Encoding.Convert(Encoding.Unicode, UTF8Encoding.UTF8, myBytes);
byte[] hashBytes = hashAlgorithm.ComputeHash(myUTF8Bytes);
return Convert.ToBase64String(hashBytes);
}