sample code to find unsupported character conversions

/*
    http://en.wikipedia.org/wiki/Code_page_1252
    http://en.wikipedia.org/wiki/EBCDIC_037
  
    http://stackoverflow.com/questions/13389182/in-net-how-do-i-determine-what-characters-existing-in-the-windows-1252-codepag
 
 
    Notes:
    (1) There is a problem in the code.  The .Net conversion from Windows 1252 to IBM 37 has problem.  It converted the of Ÿ (159 in windows 12562) to "Y" (232 IBM 37) instead of "Ÿ" (255 IBM 37).
    (2) The Console cannot display all the characters on the terminal.
 */

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace test_code_page
{
    class find_unsupported_conversions
    {
        static void Main(string[] args)
        {
            FileStream stream = null;
            StreamWriter streamwriter = null;
            TextWriter console_streamwriter = Console.Out;
            string path;

            if (args.Length == 1)
                path = args[0];
            else
            {
                Console.Write("Enter path: ");
                path = Console.ReadLine();
            }

            try
            {
                stream = new FileStream(path, FileMode.CreateNew, FileAccess.Write);
                streamwriter = new StreamWriter(stream);
                Console.SetOut(streamwriter);
            }
            catch (Exception e)
            {
                Console.WriteLine("Cannot open '" + path + "' for writing");
                Console.WriteLine(e.Message);
            }

            test_code_pages();

            Console.SetOut(console_streamwriter);
            if (streamwriter != null)
                streamwriter.Close();
            if (stream != null)
                stream.Close();
        }

        private static void test_code_pages()
        {
            Encoding source_encoding = Encoding.GetEncoding("Windows-1252");
            Encoding target_encoding = Encoding.GetEncoding("IBM037");
            
            byte source_question_mark = source_encoding.GetBytes("?")[0];
            byte target_question_mark = target_encoding.GetBytes("?")[0];

            int count = 0;
            byte[] b = new byte[1];
            for (int i = 0; i < 256; i++)
            {
                b[0] = (byte)i;
                if (b[0] != source_question_mark && Encoding.Convert(source_encoding, target_encoding, b)[0] == target_question_mark)
                {
                    count++;
                    Console.WriteLine(source_encoding.GetString(b) + " " + i.ToString());
                }
            }

            Console.WriteLine(count.ToString() + " unsupported.");
        }
    }
}

C# InputBox

using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;

namespace input
{
    public class InputBox : Form
    {
        private Container components = null;

        private Label label;
        private TextBox textbox;
        private Button button;

        private string input_value = "";

        public InputBox(string prompt) : this(prompt, "", ""){}

        public InputBox(string prompt, string title) : this(prompt, title, "") {}

        public InputBox(string prompt, string title, string default_value)
        {
            Init();
            set(prompt, title, default_value);
        }

        private void set(string prompt, string title, string default_value)
        {
            this.label.Text = prompt;
            this.Text = title;
            this.textbox.Text = default_value;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
                if (components != null)
                    components.Dispose();
            base.Dispose(disposing);
        }

        private void Init()
        {
            this.label = new Label();
            this.textbox = new TextBox();
            this.button = new Button();

            this.SuspendLayout();

            this.label.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            this.label.Location = new Point(10, 10);
            this.label.Size = new Size(190, 20);

            this.textbox.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            this.textbox.Location = new Point(10, 35);
            this.textbox.Size = new Size(150, 25);
            this.textbox.KeyPress += new KeyPressEventHandler(textbox_KeyPress);

            this.button.Anchor = AnchorStyles.Right;
            this.button.Location = new Point(170, 33);                        
            this.button.Text = "OK";            
            this.button.Click += new System.EventHandler(this.button_Click);

            Controls.Add(this.label);
            Controls.Add(this.textbox);
            Controls.Add(this.button);

            // enable the escape key
            this.CancelButton = null;
            this.KeyPreview = true;
            this.KeyPress += new KeyPressEventHandler(InputBox_KeyPress);

            this.Size = new Size(260, 100);
            this.MinimizeBox = false;
            this.MaximizeBox = false;
            this.Name = "InputBox";

            this.ResumeLayout(false);
        }

        void InputBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Escape)
            {
                this.Value = null;
                this.Close();
            }
        }

        void textbox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
                this.button.PerformClick();
        }


        private void button_Click(object sender, EventArgs e)
        {
            this.Value = this.textbox.Text;
            this.Close();
        }

        public string Value
        {
            get { return this.input_value; }
            set { this.input_value = value; }
        }

        public string Show()
        {
            this.ShowDialog();
            return this.Value;
        }

        public string Show(string prompt)
        {
            return Show(prompt, "", "");
        }

        public string Show(string prompt, string title)
        {
            return Show(prompt, title, "");
        }

        public string Show(string prompt, string title, string default_value)
        {
            set(prompt, title, default_value);
            return Show();
        }
    }
}