public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
{
int byteCount = 0;
ushort u;
char c;
for (int i = 0; i < charCount; charIndex++, byteIndex++, byteCount++, i++)
{
c = chars[charIndex];
u = _unicodeToDbcs[c];
if (u == 0 && c != 0)
{
bytes[byteIndex] = 0x3f; // 0x3f == '?'
}
else if (u < 0x100)
{
bytes[byteIndex] = (byte)u;
}
else
{
bytes[byteIndex] = (byte)((u >> 8) & 0xff);
byteIndex++;
byteCount++;
bytes[byteIndex] = (byte)(u & 0xff);
}
}
return byteCount;
}