New test.
[mono.git] / mcs / class / I18N / Other / CP1257.cs
index cac55af6055c1dfe54b96790310121a65c620400..d2f351d8cfb395cbb9b1f105bfcdcb25b95a462e 100644 (file)
@@ -28,8 +28,10 @@ namespace I18N.Other
 {
 
 using System;
+using System.Text;
 using I18N.Common;
 
+[Serializable]
 public class CP1257 : ByteEncoding
 {
        public CP1257()
@@ -84,10 +86,15 @@ public class CP1257 : ByteEncoding
                '\u00FC', '\u017C', '\u017E', '\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++]);
@@ -225,15 +232,21 @@ public class CP1257 : 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)
        {
@@ -383,9 +396,11 @@ public class CP1257 : ByteEncoding
                        --charCount;
                }
        }
+       */
 
 }; // class CP1257
 
+[Serializable]
 public class ENCwindows_1257 : CP1257
 {
        public ENCwindows_1257() : base() {}