private IRubyObject smartChopBangCommon19(Ruby runtime) {
final int p = value.getBegin();
int len = value.getRealSize();
int end = p + len;
byte bytes[] = value.getUnsafeBytes();
Encoding enc = value.getEncoding();
keepCodeRange();
if (enc.minLength() > 1) {
int pp = enc.leftAdjustCharHead(bytes, p, end - enc.minLength(), end);
if (enc.isNewLine(bytes, pp, end)) end = pp;
pp = end - enc.minLength();
if (pp >= p) {
pp = enc.leftAdjustCharHead(bytes, p, pp, end);
if (StringSupport.preciseLength(enc, bytes, pp, end) > 0 &&
enc.mbcToCode(bytes, pp, end) == '\r') end = pp;
}
if (end == p + value.getRealSize()) {
modifyCheck();
return runtime.getNil();
}