qpencode(result, lCurElemString, occurrences);
}
break;
case 'U' :
UTF8Encoding enc = UTF8Encoding.INSTANCE;
byte[] packedBytes = new byte[enc.maxLength() * occurrences];
int index = 0;
while (occurrences-- > 0) {
if (listSize-- <= 0) {
throw runtime.newArgumentError(sTooFew);
}
IRubyObject from = list.eltInternal(idx++);
int code = from == runtime.getNil() ? 0 : RubyNumeric.num2int(from);
if (code < 0) {
throw runtime.newRangeError(
"pack(U): value out of range");
}
int length = enc.codeToMbc(code, packedBytes, index);
result.append(packedBytes, index, length);
index += length;
}
break;
case 'w' :