+ // 00 00 - FF FF
+ int origIndex = byteIndex;
+ while (charCount-- > 0)
+ {
+ char c = chars[charIndex++];
+ if (c <= 0x80 || c == 0xFF)
+ { // ASCII
+ bytes[byteIndex++] = (byte)c;
+ continue;
+ }
+ byte b1 = convert.u2n[((int)c) * 2];
+ byte b2 = convert.u2n[((int)c) * 2 + 1];
+ if (b1 == 0 && b2 == 0)
+ {
+#if NET_2_0
+ HandleFallback (ref buffer, chars, ref charIndex, ref charCount,
+ bytes, ref byteIndex, ref byteCount, null);
+#else
+ bytes[byteIndex++] = (byte)'?';
+#endif
+ }
+ else
+ {
+ bytes[byteIndex++] = b1;
+ bytes[byteIndex++] = b2;
+ }
+ }
+ return byteIndex - origIndex;
+ }
+#endif
+ // Get the characters that result from decoding a byte buffer.