private void renderChars(CharSequence stringValue, RENDER_ENUM renderSetting) {
		for (int i = 0, strLength = stringValue.length(); i < strLength;) {
			int codePoint = Character.codePointAt(stringValue, i);

			if (StringUtilities.isControlCharacterOrBackslash(codePoint)) {
				addString(StringUtilities.convertCodePointToEscapeSequence(codePoint));
			}
			else if (codePoint == 0) {
				if (byteMode) {
					addByteSeq(0);
				}
				else {
					addString("\\0");
				}
			}
			else if (Character.isISOControl(codePoint) || !Character.isDefined(codePoint)) {
				addByteSeq(codePoint);
			}
			else if (StringUtilities.isDisplayable(codePoint)) {
				addCodePointChar(codePoint);
			}
			else if (codePoint == StringUtilities.UNICODE_BE_BYTE_ORDER_MARK) {
				addEscapedCodePoint(codePoint);
			}
			else {
				switch (renderSetting) {
					default:
					case ALL:
						addCodePointChar(codePoint);
						break;
					case BYTE_SEQ:
						addByteSeq(codePoint);
						break;
					case ESC_SEQ:
						addEscapedCodePoint(codePoint);
						break;
				}
			}

			i += Character.charCount(codePoint);
		}

	}
Adds the characters found in the supplied {@link ByteBuffer} to the result.
<p>
Any portions of the byte buffer that cause problems for the charset codec will be added
as a {@link #addByteSeq(ByteBuffer, int) byte sequence}.
<p>
Characters that are outside the traditional ASCII range will be rendered as-is or as
escape sequences, depending on the RENDER_ENUM setting.
 
@param bb {@link ByteBuffer} containing bytes of a string
@param renderSetting {@link RENDER_ENUM}
@param trimTrailingNulls boolean flag, if true trailing null bytes will not be included
in the rendered output
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/StringRenderBuilder.java