Merge pull request #485 from mtausig/master
[mono.git] / mcs / class / I18N / Rare / CP1141.cs
index 345b13d5cf9d9eb2c26f27f8561bf0b5ae5618b2..40ad50b3e6113b5751cd49264050c4187b54bc2c 100644 (file)
@@ -28,8 +28,10 @@ namespace I18N.Rare
 {
 
 using System;
+using System.Text;
 using I18N.Common;
 
+[Serializable]
 public class CP1141 : ByteEncoding
 {
        public CP1141()
@@ -84,10 +86,15 @@ public class CP1141 : ByteEncoding
                '\u005D', '\u00D9', '\u00DA', '\u009F', 
        };
 
-       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++]);
@@ -477,13 +484,21 @@ public class CP1141 : ByteEncoding
                                case 0xFF5C: ch = 0xBB; break;
                                case 0xFF5D: ch = 0xDC; break;
                                case 0xFF5E: ch = 0x59; break;
-                               default: ch = 0x3F; break;
+                               default:
+#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)
        {
@@ -883,9 +898,11 @@ public class CP1141 : ByteEncoding
                        --charCount;
                }
        }
+       */
 
 }; // class CP1141
 
+[Serializable]
 public class ENCibm01141 : CP1141
 {
        public ENCibm01141() : base() {}