Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions C-Sharp/CreateTicketWithAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,35 @@ class CreateTicketWithAttachment

private static void writeCRLF(Stream o)
{
byte[] crLf = Encoding.ASCII.GetBytes("\r\n");
byte[] crLf = Encoding.UTF8.GetBytes("\r\n");
o.Write(crLf, 0, crLf.Length);
}

private static void writeBoundaryBytes(Stream o, string b, bool isFinalBoundary)
{
string boundary = isFinalBoundary == true ? "--" + b + "--" : "--" + b + "\r\n";
byte[] d = Encoding.ASCII.GetBytes(boundary);
byte[] d = Encoding.UTF8.GetBytes(boundary);
o.Write(d, 0, d.Length);
}

private static void writeContentDispositionFormDataHeader(Stream o, string name)
{
string data = "Content-Disposition: form-data; name=\"" + name + "\"\r\n\r\n";
byte[] b = Encoding.ASCII.GetBytes(data);
byte[] b = Encoding.UTF8.GetBytes(data);
o.Write(b, 0, b.Length);
}

private static void writeContentDispositionFileHeader(Stream o, string name, string fileName, string contentType)
{
string data = "Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + fileName + "\"\r\n";
data += "Content-Type: " + contentType + "\r\n\r\n";
byte[] b = Encoding.ASCII.GetBytes(data);
byte[] b = Encoding.UTF8.GetBytes(data);
o.Write(b, 0, b.Length);
}

private static void writeString(Stream o, string data)
{
byte[] b = Encoding.ASCII.GetBytes(data);
byte[] b = Encoding.UTF8.GetBytes(data);
o.Write(b, 0, b.Length);
}

Expand Down Expand Up @@ -123,7 +123,7 @@ static void Main(string[] args)
Console.WriteLine("Submitting Request");
var response = (HttpWebResponse)wr.GetResponse();
Stream resStream = response.GetResponseStream();
string Response = new StreamReader(resStream, Encoding.ASCII).ReadToEnd();
string Response = new StreamReader(resStream, Encoding.UTF8).ReadToEnd();
//return status code
Console.WriteLine("Status Code: {1} {0}", ((HttpWebResponse)response).StatusCode, (int)((HttpWebResponse)response).StatusCode);
//return location header
Expand Down
2 changes: 1 addition & 1 deletion C-Sharp/GetTickets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ static void Main()
Console.WriteLine(ex.Message);
}
}
}
}