This is close, but you need to

* use the same compareTo in all cases.
* call SchemaUtil.getCharUnpaddedLength on both the lhs and rhs (if either is a CHAR)
* have the SchemaUtil.getCharUnpaddedLength just return the new length. No need to re-allocate a new byte array.
* pass the lhs or rhs columnModifier into the getCharUnpaddedLength (something I hadn't thought of before). If the columnModifier is DESC, then instead of looking for a null byte, you'll look for a 255 byte, since the bytes are inverted in that case.

So like this:

      if (rhsDataType == PDataType.CHAR) {
          rhsLength = SchemaUtil.getCharUnpaddedLength(rhsBytes, rhsOffset, rhsLength, rhsColumnModifier);
      }
      if (lhsDataType == PDataType.CHAR) {
          lhsLength = SchemaUtil.getCharUnpaddedLength(lhsBytes, lhsOffset, lhsLength, lhsColumnModifier);
      }

      comparisonResult = lhsDataType.compareTo(lhsBytes, lhsOffset, lhsLength, lhsColumnModifier, 
                                                                         rhsBytes, rhsOffset, rhsLength, rhsColumnModifier, rhsDataType);