private void createCaseInsensitiveBytesAndMasks(Charset encodingCharSet, byte[] bytes,
			byte[] masks) {
		int i = 0;
		while (i < bytes.length) {
			if (encodingCharSet == StandardCharsets.US_ASCII &&
				Character.isLetter(bytes[i])) {
				masks[i] = CASE_INSENSITIVE_MASK;
				bytes[i] = (byte) (bytes[i] & CASE_INSENSITIVE_MASK);
				i++;
			}
			else if (encodingCharSet == StandardCharsets.UTF_8) {
				int numBytes = bytesPerCharUTF8(bytes[i]);
				if (numBytes == 1 && Character.isLetter(bytes[i])) {
					masks[i] = CASE_INSENSITIVE_MASK;
					bytes[i] = (byte) (bytes[i] & CASE_INSENSITIVE_MASK);
				}
				i += numBytes;
			}
			// Assumes UTF-16 will return 2 Bytes for each character.
			// 4-byte UTF-16 will never satisfy the below checks because
			// none of their bytes can ever be 0.
			else if (encodingCharSet == StandardCharsets.UTF_16BE) {
				if (bytes[i] == (byte) 0x0 && Character.isLetter(bytes[i + 1])) { // Checks if ascii character.
					masks[i + 1] = CASE_INSENSITIVE_MASK;
					bytes[i + 1] = (byte) (bytes[i + 1] & CASE_INSENSITIVE_MASK);
				}
				i += 2;
			}
			else if (encodingCharSet == StandardCharsets.UTF_16LE) {
				if (bytes[i + 1] == (byte) 0x0 && Character.isLetter(bytes[i])) { // Checks if ascii character.
					masks[i] = CASE_INSENSITIVE_MASK;
					bytes[i] = (byte) (bytes[i] & CASE_INSENSITIVE_MASK);
				}
				i += 2;
			}
			else {
				i++;
			}
		}
	}
{@link SearchFormat} for parsing and display bytes in a string format. This format uses
several values from SearchSettings included character encoding, case sensitive, and escape
sequences.
Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/format/StringSearchFormat.java