// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Globalization; using System.Text; using System.Text.RegularExpressions; namespace E { public class MainClass { public static string FromQP1(string s) { return s.Replace("=E6", "æ").Replace("=F8", "ø").Replace("=E5", "å").Replace("=C6", "Æ").Replace("=D8", "Ø").Replace("=C5", "Å"); } public static string FromQP2(string s) { StringBuilder sb = new StringBuilder(""); int ix = 0; while(ix < s.Length) { if(s[ix] == '=') { sb.Append((char)int.Parse(s.Substring(ix + 1, 2), NumberStyles.HexNumber)); ix += 3; } else { sb.Append(s[ix]); ix++; } } return sb.ToString(); } public static void Main(string[] args) { string s = "ABC=E6=F8=E5=C6=D8=C5123"; Console.WriteLine(FromQP1(s)); Console.WriteLine(FromQP2(s)); } } }