// 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.Text; namespace E { public class Program { public static string ISO646_SE_NRC_fix(string s) { // this does not work as .NET does not come with support for ISO 646 Swedish NRC (code page 1018): // return Encoding.GetEncoding(1018).GetString(Encoding.ASCII.GetBytes(s)); // so the dirty hack: return s.Replace('[', '�').Replace('\\', '�').Replace(']', '�').Replace('{', 'ö').Replace('|', 'ä').Replace('}', 'å'); } public static void Main(string[] args) { Console.WriteLine(ISO646_SE_NRC_fix("ABCabc123")); Console.WriteLine(ISO646_SE_NRC_fix("Difftr L{ttfasavsk")); } } }