public void GetBytes(string source, int index, int count, byte[] bytes, int byteIndex) { byte[] expectedBytes = new byte[count]; for (int i = 0; i < expectedBytes.Length; i++) { if (source[i] >= 0x0 && source[i] <= 0x7f) { expectedBytes[i] = (byte)source[i + index]; } else { // Verify the fallback character for non-ASCII chars expectedBytes[i] = (byte)'?'; } } EncodingHelpers.GetBytes(new ASCIIEncoding(), source, index, count, bytes, byteIndex, expectedBytes); }
public void GetBytes(string source, int index, int count, byte[] bytes, int byteIndex, byte[] expectedBytes) { EncodingHelpers.GetBytes(new UnicodeEncoding(), source, index, count, bytes, byteIndex, expectedBytes); }