--- CHARACTER CONVERTERS ---
969466
protected static final void append(StringBuilder builder, String key, String value) {

		// Convert key
		String formattedKey = key.replace('[', '.').replace("]", "");

		// Append key
		char c;
		boolean replace = false;
		char[] chars = formattedKey.toCharArray();
		for (int i = 0; i < chars.length; i++) {
			c = chars[i];
			if ((c > 0xFF) || KEY_ESCAPES[c] != 0) {
				replace = true;
				break;
			}
		}
		if (replace) {
			appendWithEscapes(builder, formattedKey, KEY_ESCAPES);
		} else {
			builder.append(formattedKey);
		}
		builder.append('=');

		// Append value
		if (value != null && !value.isEmpty()) {
			replace = false;
			chars = value.toCharArray();
			for (int i = 0; i < chars.length; i++) {
				c = chars[i];
				if ((c > 0xFF) || VALUE_ESCAPES[c] != 0) {
					replace = true;
					break;
				}
			}
			if (replace) {
				appendWithEscapes(builder, value, VALUE_ESCAPES);
			} else {
				builder.append(value);
			}
		}

		// Line break
		builder.append(LINE_SEPARATOR);
	}
477528
def string_to_numeric_char_reference(string):
    
    out = ""
    for char in string:
        out += "&#" + str(ord(char)) + ";"
    return out
1177909
function charCodesToString(charCodes) {
  // Use these methods to be able to convert large strings
  if (hasProperty('Buffer')) {
    return Buffer.from(charCodes).toString(STR_ENCODING)
  } else if (hasProperty('TextDecoder')) {
    return new TextDecoder(STR_ENCODING) // eslint-disable-line no-undef
      .decode(new Int8Array(charCodes))
  }

  // Fallback method
  let str = ''

  for (let i = 0; i < charCodes.length; i += STR_SLICE_SIZE) {
    str += String.fromCharCode.apply(
      null,
      charCodes.slice(i, i + STR_SLICE_SIZE)
    )
  }

  return str
}
780864
@Override
    public void characters(char[] ch, int start, int length)
            throws SAXException {
        try {
            for (int j = 0; j < length; j++) {
                char c = ch[start + j];
                switch (c) {
                    case '<':
                        this.writer.write("&lt;");
                        break;
                    case '>':
                        this.writer.write("&gt;");
                        break;
                    case '&':
                        this.writer.write("&amp;");
                        break;
                    default:
                        this.writer.write(c);
                }
            }
        } catch (IOException ioe) {
            throw (SAXException)new SAXException(ioe).initCause(ioe);
        }
    }
429672
@Override
    public void characters(char[] ch, int start, int length)
        throws SAXException {
        if (vIsOpen) {
            value.append(ch, start, length);
        }
        if (fIsOpen) {
            formula.append(ch, start, length);
        }
        if (hfIsOpen) {
            headerFooter.append(ch, start, length);
        }
    }
1148052
def strip_accents(s, encoding= 'utf-8'):
    """"""
    if sys.version < '3':
        if isinstance(s,unicode):
           return unicodedata.normalize('NFKD', s).encode('ASCII', 'ignore')
        else:
           return unicodedata.normalize('NFKD', unicode(s,encoding)).encode('ASCII', 'ignore')
    else:
        if isinstance(s,bytes): s = str(s,encoding)
        return str(unicodedata.normalize('NFKD', s).encode('ASCII', 'ignore'),'ascii')
483067
function _utf8ToChar(&$chars, &$idx)
	{
		if(($chars[$idx] >= 240) && ($chars[$idx] <= 255))
			/* 4 bytes */
			$utf =    ((int)($chars[$idx]-240)   << 18) +
				((int)($chars[++$idx]-128) << 12) +
				((int)($chars[++$idx]-128) << 6) +
				((int)($chars[++$idx]-128) << 0);
		else if (($chars[$idx] >= 224) && ($chars[$idx] <= 239))
			/* 3 bytes */
			$utf =    ((int)($chars[$idx]-224)   << 12) +
				((int)($chars[++$idx]-128) << 6) +
				((int)($chars[++$idx]-128) << 0);
		else if (($chars[$idx] >= 192) && ($chars[$idx] <= 223))
			/* 2 bytes */
			$utf =    ((int)($chars[$idx]-192)   << 6) +
				((int)($chars[++$idx]-128) << 0);
		else
			/* 1 byte */
			$utf = $chars[$idx];
		if(array_key_exists($utf,$this->utfMap))
			return \chr($this->utfMap[$utf]);
		else
			return "?";
	}
1189541
@Override
    public void characters(char ch[], int start, int length) {
	content.append(new String(ch, start, length));
    }
1314075
def put_char(self, char, r, g, b):
		
		r, g, b = r & 0xff, g & 0xff, b & 0xff
		if(char == 0):
			char = " "

		if(char == "\r"):
			self.cursor[1] = 0
			return
		if(char == "\t"):
			for i in range(8):
				self.put_char(" ", r, g, b)
			return
		
		if(self.max_chars_per_col > self.cursor[0]):
			if(char == "\n"):
				self.cursor[1] = 0
				self.cursor[0] += 1
				return

			if(self.max_chars_per_line > self.cursor[1]):
				self.char_buffer[self.cursor[0]][self.cursor[1]] = (char, r, g, b)
				self.cursor[1] += 1
			else:
				self.cursor[0] += 1
				self.cursor[1] = 0
				self.char_buffer[self.cursor[0]][self.cursor[1]] = (char, r, g, b)
				self.cursor[1] += 1
			self.draw_char_screen()
		else:
			self.char_buffer.append([(" ", 0xff, 0xff, 0xff) for i in range(self.max_chars_per_line)])
			self.cursor[0] -= 1
			self.put_char(char, r, g, b)
770422
public static String convertText(String s) {
        StringCharacterIterator stringcharacteriterator = new StringCharacterIterator(s);
        StringBuffer stringbuffer = new StringBuffer();
        int ai[] = new int[s.length()];
        int i = 0;
        int j = 0;
        for(char c = stringcharacteriterator.first(); c != '\uFFFF'; c = stringcharacteriterator.next())
            if(c == '%')
            {
                c = stringcharacteriterator.next();
                if(c != '%')
                {
                    stringbuffer.append('%');
                    c = stringcharacteriterator.previous();
                } else
                {
                    c = stringcharacteriterator.next();
                    switch(c)
                    {
                    case 37: // '%'
                        stringbuffer.append('%');
                        break;

                    case 80: // 'P'
                    case 112: // 'p'
                        stringbuffer.append('\361');
                        break;

                    case 67: // 'C'
                    case 99: // 'c'
                        stringbuffer.append('\355');
                        break;

                    case 68: // 'D'
                    case 100: // 'd'
                        stringbuffer.append('\u00b0');
                        break;

                    case 85: // 'U'
                    case 117: // 'u'
                        ai[stringbuffer.length()] ^= 1;
                        i++;
                        break;

                    case 79: // 'O'
                    case 111: // 'o'
                        ai[stringbuffer.length()] ^= 2;
                        j++;
                        break;

                    default:
                        if(c >= '0' && c <= '9')
                        {
                            int k = 3;
                            char c1 = (char)(c - 48);
                            for(c = stringcharacteriterator.next(); c >= '0' && c <= '9' && --k > 0; c = stringcharacteriterator.next())
                                c1 = (char)(10 * c1 + (c - 48));

                            stringbuffer.append(c1);
                        }
                        c = stringcharacteriterator.previous();
                        break;
                    }
                }
            } else
            if(c == '^')
            {
                c = stringcharacteriterator.next();
                if(c == ' ')
                    stringbuffer.append('^');
            } else
            {
                stringbuffer.append(c);
            }
        s = Unicode.char2DOS437(stringbuffer, 2, '?');

		String ss = s;
		return ss;
	}
}
382497
private static String escapeJavaScriptChars(String s) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            switch (ch) {
                case '\b':
                    sb.append("\\b");
                    break;
                case '\t':
                    sb.append("\\t");
                    break;
                case '\n':
                    sb.append("\\n");
                    break;
                case '\f':
                    sb.append("\\f");
                    break;
                case '\r':
                    sb.append("\\r");
                    break;
                case '"':
                    sb.append("\\\"");
                    break;
                case '\'':
                    sb.append("\\\'");
                    break;
                case '\\':
                    sb.append("\\\\");
                    break;
                default:
                    if (ch < 32 || ch >= 127) {
                        sb.append(String.format("\\u%04X", (int)ch));
                    } else {
                        sb.append(ch);
                    }
                    break;
            }
        }
        return sb.toString();
    }
1235421
@SuppressWarnings("rawtypes")
	public String replace(String source,char replaceChar)
	{
		StringBuilder sb = new StringBuilder(source);
		char[] chars = source.toCharArray();
		int start = -1, end = -1;
		Map nowMap = pool;
		for (int i = 0; i < chars.length; i++)
		{
			char ch = Character.toUpperCase(chars[i]);
			nowMap = (Map) nowMap.get(ch);
			if (nowMap != null)
			{
				if (start == -1)
				{
					start = i;
				}
				if ("1".equals(nowMap.get("isEnd")))
				{
					end = i;
					for (int j = start; j <= end; j++)
					{
						sb.setCharAt(j, replaceChar);
					}
					start = -1; end = -1;
				}
			}
			else
			{
				start = -1;
				nowMap = pool;
				nowMap = (Map) nowMap.get(ch);
				if (nowMap != null)
				{
					if (start == -1)
					{
						start = i;
					}
					if ("1".equals(nowMap.get("isEnd")))
					{
						end = i;
						for (int j = start; j <= end; j++)
						{
							sb.setCharAt(j, replaceChar);
						}
						start = -1; end = -1;
					}
				}
				else
				{
					nowMap = pool;
				}
			}
		}
		return sb.toString();
	}
1046524
static String toChars(String p) {
      if (p.length() >= 3 && p.charAt(0) == '[' && p.charAt(p.length() - 1) == ']') {
         return p.substring(1, p.length() - 1);
      }
      return p;
   }
794735
def _preprocess_chars(self, chars):
        '''
        
        '''
        chars = self._normalize_dakuten(chars)
        chars = self._process_repeaters(chars)
        chars = self._perform_replacements(chars)

        return chars
449575
public final int toChars(int[] src, int srcOff, int srcLen, char[] dest, int destOff) {
    if (srcLen < 0) {
      throw new IllegalArgumentException("srcLen must be >= 0");
    }
    int written = 0;
    for (int i = 0; i < srcLen; ++i) {
      written += Character.toChars(src[srcOff + i], dest, destOff + written);
    }
    return written;
  }
403340
def _allowed_char(c):
    
    c = ord(c)
    if c < 0:
        return False
    if c < 128:
        return _ascii_allowed[c]
    # Genereally allow unicodes, TODO: check for unicode control characters
    # characters
    return True
1338118
def characters(self, chars):
        
        self._finish_pending_start_element()
        if not is_valid_cdata_str(chars):
            raise ValueError("control characters are not allowed in "
                             "well-formed XML")
        self._write(xml.sax.saxutils.escape(
            chars,
            self._additional_escapes,
        ).encode("utf-8"))