Index: Convert.cs
===================================================================
--- Convert.cs	(revision 1027)
+++ Convert.cs	(working copy)
@@ -15,6 +15,7 @@
 
 namespace SharpOS.Kernel.Foundation {
 	public unsafe class Convert {
+		public const byte NonAsciiCharacter = 0x7f;
 
 		public unsafe static int ToInt32 (CString8 *str)
 		{
@@ -251,8 +252,9 @@
 
 		internal unsafe static void __RunTests ()
 		{
-			__Test1 ();
-			__Test2 ();
+			//__Test1 ();
+			//__Test2 ();
+			__Test3 ();
 
 		}
 
@@ -286,6 +288,60 @@
                 }
 
 
+		public static void __Test3 ()
+		{
+			char aCharacter = 'a';
+			string emptyString = "";
+			string otherString = "Û<=>";
+			char [] otherArray = new char [3];
+			otherArray [0] = 'x';
+			otherArray [1] = 'y';
+			otherArray [2] = 'z';
+
+			Testcase.Test (ToAscii (aCharacter) == 0x61,
+				     "Convert.ToAscii()",
+				     "char 'a' to Ascii");
+
+			byte [] currentArray = ToAscii (emptyString);
+
+			Testcase.Test (currentArray.Length == 0,
+				     "Convert.ToAscii()",
+				     "string \"\" to Ascii");
+
+			currentArray = ToAscii (otherString);
+
+			Testcase.Test (currentArray.Length == 4,
+				     "Convert.ToAscii()",
+				     "string \"Û<=>\" to Ascii(length)");
+			Testcase.Test (currentArray [0] == NonAsciiCharacter,
+				     "Convert.ToAscii()",
+				     "string \"Û<=>\" to Ascii[0]");
+			Testcase.Test (currentArray [1] == 0x3C,
+				     "Convert.ToAscii()",
+				     "string \"Û<=>\" to Ascii[1]");
+			Testcase.Test (currentArray [2] == 0x3D,
+				     "Convert.ToAscii()",
+				     "string \"Û<=>\" to Ascii[2]");
+			Testcase.Test (currentArray [3] == 0x3E,
+				     "Convert.ToAscii()",
+				     "string \"Û<=>\" to Ascii[3]");
+
+			currentArray = ToAscii (otherArray);
+			Testcase.Test (currentArray.Length == 3,
+				     "Convert.ToAscii()",
+				     "string \"xyz\" to Ascii(length)");
+			Testcase.Test (currentArray [0] == 0x78,
+				     "Convert.ToAscii()",
+				     "char[] \"xyz\" to Ascii[0]");
+			Testcase.Test (currentArray [1] == 0x79,
+				     "Convert.ToAscii()",
+				     "char[] \"xyz\" to Ascii[1]");
+			Testcase.Test (currentArray [2] == 0x7a,
+				     "Convert.ToAscii()",
+				     "char[] \"xyz\" to Ascii[2]");
+		}    
+
+
 		private unsafe static bool __StringComp (CString8* str1, CString8* str2)
 		{
 			byte* s1 = (byte*) str1;
@@ -297,5 +353,113 @@
 
 			return (*s1 == 0 & *s2 == 0);
 		}
+
+		/// <summary>
+		/// Converts character to ascii representation.  If unicode 
+		/// character is outside the range of an Ascii character then 
+		/// Convert.NonAsciiCharacter is returned.
+		/// </summary>
+		/// <param name="value">Character to be converted</param>
+		/// <returns>Ascii representation of the character</returns>
+		public static byte ToAscii (char value)
+		{
+			unsafe {
+				byte* uniPointer = (byte*)&value;
+				//read in first word(little Endian)
+				uint firstWord = *uniPointer;
+				uniPointer++;
+				firstWord = firstWord
+					   + ((uint)(*uniPointer) << 8);
+				if (firstWord <= 0x7F) {
+					return (byte)firstWord;
+				}
+				return NonAsciiCharacter;
+			}
+		}
+
+		/// <summary>
+		/// Converts the array of characters to ascii representation.  
+		/// If unicode character is outside the range of an Ascii 
+		/// character then Convert.NonAsciiCharacter is returned in its 
+		/// place.
+		/// </summary>
+		/// <param name="value">Array of Characters to Converted
+		/// </param>
+		/// <returns>Array of byte containing Ascii representation
+		/// </returns>
+		public static byte [] ToAscii (char [] value)
+		{
+			byte [] asciiEncoding = new byte [value.Length];
+			for (int x = 0; x < value.Length; x++) {
+				asciiEncoding [x] = ToAscii (value [x]);
+			}
+			return asciiEncoding;
+		}
+
+		/// <summary>
+		/// Converts string to its ascii representation.  If unicode 
+		/// character is outside the range of an Ascii character then 
+		/// Convert.NonAsciiCharacter is returned in its place.
+		/// </summary>
+		/// <param name="value">string to be converted</param>
+		/// <returns>Array of byte containing Ascii representation
+		/// </returns>
+		public static byte [] ToAscii (string value)
+		{
+			byte [] asciiEncoding = new byte [value.Length];
+			for (int x = 0; x < value.Length; x++) {
+				asciiEncoding [x] = ToAscii (value [x]);
+			}
+			return asciiEncoding;
+		}
+
+		/// <summary>
+		/// Converts character to an ascii c like string representation.
+		/// If unicode character is outside the range of an Ascii
+		/// character then Convert.NonAsciiCharacter is returned.
+		/// </summary>
+		/// <param name="value">char to be converted</param>
+		/// <returns></returns>
+		public unsafe static CString8* ToCString8 (char value)
+		{
+			CString8* str1 = CString8.Create (1);
+			str1->SetChar (0, ToAscii (value));
+			return str1;
+		}
+
+		/// <summary>
+		/// Converts the array of characters to an ascii c like string 
+		/// representation.  If unicode character is outside the range	
+		/// of an Ascii character then Convert.NonAsciiCharacter is 
+		/// returned in its place.
+		/// </summary>
+		/// <param name="value">Array of Characters to Converted
+		/// </param>
+		/// <returns></returns>
+		public unsafe static CString8* ToCString8 (char [] value)
+		{
+			CString8* str1 = CString8.Create (value.Length);
+			for (int x = 0; x < value.Length; x++) {
+				str1->SetChar (x, ToAscii (value [x]));
+			}
+			return str1;
+		}
+
+		/// <summary>
+		/// Converts string to its ascii representation terminating with
+		/// null.  If unicode character is outside the range of an Ascii
+		/// character then Convert.NonAsciiCharacter is returned in its 
+		/// place.
+		/// </summary>
+		/// <param name="value"></param>
+		/// <returns></returns>
+		public unsafe static CString8* ToCString8 (string value)
+		{
+			CString8* str1 = CString8.Create (value.Length);
+			for (int x = 0; x < value.Length; x++) {
+				str1->SetChar (x, ToAscii (value [x]));
+			}
+			return str1;
+		}
 	}
 }
