Merge pull request #309 from i59/patch-1
[mono.git] / mcs / class / I18N / West / CP28592.cs
index 6acf2c6ad1cb03918dbbaa54c964d5cd0cb771f4..f69b0af851759f99f80c15afa06be5d28fd96b0c 100644 (file)
@@ -28,8 +28,10 @@ namespace I18N.West
 {
 
 using System;
+using System.Text;
 using I18N.Common;
 
+[Serializable]
 public class CP28592 : ByteEncoding
 {
        public CP28592()
@@ -84,10 +86,15 @@ public class CP28592 : 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++]);
@@ -263,15 +270,21 @@ public class CP28592 : 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)
        {
@@ -459,9 +472,11 @@ public class CP28592 : ByteEncoding
                        --charCount;
                }
        }
+       */
 
 }; // class CP28592
 
+[Serializable]
 public class ENCiso_8859_2 : CP28592
 {
        public ENCiso_8859_2() : base() {}