code: private void encodeStringLiteral(ByteBuf out, CharSequence string) {
          int huffmanLength = hpackHuffmanEncoder.getEncodedLength(string);
          if (huffmanLength < string.length()) {
              encodeInteger(out, 0x80, 7, huffmanLength);
              hpackHuffmanEncoder.encode(out, string);
          } else {
              encodeInteger(out, 0x00, 7, string.length());
              if (string instanceof AsciiString) {
                  // Fast-path
                  AsciiString asciiString = (AsciiString) string;
                  out.writeBytes(asciiString.array(), asciiString.arrayOffset(), asciiString.length());
              } else {
                  // Only ASCII is allowed in http2 headers, so its fine to use this.
                  // https://tools.ietf.org/html/rfc7540#section-8.1.2
                  out.writeCharSequence(string, CharsetUtil.ISO_8859_1);
              }
          }
      }
docs: Encode string literal according to Section 5.2.