public void writeChar(HiveCharWritable writable, int length) throws IOException {
    if (writable == null) {
      String pad = join("", Collections.nCopies(length, " "));
      write(pad.getBytes("UTF8"));
      return;
    }
    Text t = writable.getStrippedValue();
    int contentLength = t.getLength();
    write(t.getBytes(), 0, contentLength);
    if (length - contentLength < 0) {
      throw new IOException(format("The byte num %s of HiveCharWritable is more than the byte num %s we can hold. "
          + "The content of HiveCharWritable is %s", contentLength, length, writable.getPaddedValue()));
    }
    if (length > contentLength) {
      String pad = join("", Collections.nCopies(length - contentLength, " "));
      write(pad.getBytes("UTF8"));
    }
  }
Write CHAR(N).
The representation of char in Teradata binary format is:
the byte number to read is based on the [charLength] * [bytePerChar] &lt;- totalLength,
bytePerChar is decided by the charset: LATIN charset is 2 bytes per char and UNICODE charset is 3 bytes per char.
the null char will use space to pad.

@param writable the writable
@param length the byte n
@throws IOException the io exception
serde/src/java/org/apache/hadoop/hive/serde2/teradata/TeradataBinaryDataOutputStream.java