I have a question regarding encoding for text email messages using C# .net because I have mine as simple ASCII but when doing padding for formatting a recipt to the user the data is not lining up although when I check the lines in say NotePad++ they are exactly the same No. of character. Below is some code, can anyone tell me what I'm doing wrong?
StringBuilder oSB = new StringBuilder(); oSB.AppendLine(EmailLine("Amount", oTrans.PaymentAmount.ToString())); oSB.AppendLine(EmailLine("Payment Method", oTrans.CardType)); private static string EmailLine(string FieldLabel, string FieldVal) { return PadLabel(FieldLabel) + FieldVal ; } private static string PadLabel(string FieldLabel) { return FieldLabel.PadRight(40, char.Parse(" ")) + ": "; }
My output looks like this:
Amount : 100.00
Payment Method : VISA