public static String truncateByByteLength(String str, Charset charset, int maxBytes, int factor,
			boolean appendDots) {
		//字符数*速算因子<=最大字节数
		if (str == null || str.length() * factor <= maxBytes) {
			return str;
		}
		final byte[] sba = str.getBytes(charset);
		if (sba.length <= maxBytes) {
			return str;
		}
		//限制字节数
		final int limitBytes;
		if (appendDots) {
			limitBytes = maxBytes - "...".getBytes(charset).length;
		} else {
			limitBytes = maxBytes;
		}
		final ByteBuffer bb = ByteBuffer.wrap(sba, 0, limitBytes);
		final CharBuffer cb = CharBuffer.allocate(limitBytes);
		final CharsetDecoder decoder = charset.newDecoder();
		//忽略被截断的字符
		decoder.onMalformedInput(CodingErrorAction.IGNORE);
		decoder.decode(bb, cb, true);
		decoder.flush(cb);
		final String result = new String(cb.array(), 0, cb.position());
		if (appendDots) {
			return result + "...";
		}
		return result;
	}
@Test
	public void truncateByByteLengthTest() {
		final String str = "This is English";
		final String ret = StrUtil.truncateByByteLength(str, StandardCharsets.ISO_8859_1, 10, 1, false);
		assertEquals("This is En", ret);
	}