+#else
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetByteCount(char[] chars, int index, int count)
+ {
+ DbcsConvert convert = GetConvert();
+ int length = 0;
+
+ while (count-- > 0)
+ {
+ char c = chars[index++];
+ if (c <= 0x80 || c == 0xFF)
+ { // ASCII
+ length++;
+ continue;
+ }
+ byte b1 = convert.u2n[((int)c) * 2 + 1];
+ byte b2 = convert.u2n[((int)c) * 2];
+ if (b1 == 0 && b2 == 0)
+ {
+ // FIXME: handle fallback for GetByteCountImpl().
+ length++;
+ }
+ else
+ length += 2;
+ }
+ return length;
+ }
+
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
+ {
+ int byteCount = bytes.Length;
+ int end = charIndex + charCount;
+
+ DbcsConvert convert = GetConvert();
+ EncoderFallbackBuffer buffer = null;
+
+ int origIndex = byteIndex;
+ for (int i = charIndex; i < end; i++, charCount--)
+ {
+ char c = chars[i];
+ if (c <= 0x80 || c == 0xFF)
+ { // ASCII
+ bytes[byteIndex++] = (byte)c;
+ continue;
+ }
+ byte b1 = convert.u2n[((int)c) * 2 + 1];
+ byte b2 = convert.u2n[((int)c) * 2];
+ if (b1 == 0 && b2 == 0)
+ {
+ HandleFallback (ref buffer, chars, ref i, ref charCount,
+ bytes, ref byteIndex, ref byteCount, null);
+ }
+ else
+ {
+ bytes[byteIndex++] = b1;
+ bytes[byteIndex++] = b2;
+ }
+ }
+ return byteIndex - origIndex;
+ }
+#endif