New test.
[mono.git] / mcs / class / I18N / West / CP1250.cs
index 1cdd1d56f4b886cfd3af157eff569bb689862766..a96936547cc05ae4d9b5d54dd5b50e35862d742f 100644 (file)
@@ -28,8 +28,10 @@ namespace I18N.West
 {
 
 using System;
+using System.Text;
 using I18N.Common;
 
+[Serializable]
 public class CP1250 : ByteEncoding
 {
        public CP1250()
@@ -84,10 +86,15 @@ public class CP1250 : ByteEncoding
                '\u00FC', '\u00FD', '\u0163', '\u02D9', 
        };
 
-       protected override void ToBytes(char[] chars, int charIndex, int charCount,
-                                       byte[] bytes, int byteIndex)
+       protected unsafe override void ToBytes(char* chars, int charCount,
+                                       byte* bytes, int byteCount)
        {
                int ch;
+               int charIndex = 0;
+               int byteIndex = 0;
+#if NET_2_0
+               EncoderFallbackBuffer buffer = null;
+#endif
                while(charCount > 0)
                {
                        ch = (int)(chars[charIndex++]);
@@ -227,15 +234,21 @@ public class CP1250 : ByteEncoding
                                        if(ch >= 0xFF01 && ch <= 0xFF5E)
                                                ch -= 0xFEE0;
                                        else
+#if NET_2_0
+                                               HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+#else
                                                ch = 0x3F;
+#endif
                                }
                                break;
                        }
                        bytes[byteIndex++] = (byte)ch;
                        --charCount;
+                       --byteCount;
                }
        }
 
+       /*
        protected override void ToBytes(String s, int charIndex, int charCount,
                                        byte[] bytes, int byteIndex)
        {
@@ -387,9 +400,11 @@ public class CP1250 : ByteEncoding
                        --charCount;
                }
        }
+       */
 
 }; // class CP1250
 
+[Serializable]
 public class ENCwindows_1250 : CP1250
 {
        public ENCwindows_1250() : base() {}