Return True if character needs escaping, else False.
439527
def _needescape(c):
        

        return not ascii.isprint(c) or c == '"' or c == '\\' or ascii.isctrl(c)
617678
function (stopCond, doEscaping) {
    var escaped = false
    while (i < src.length && (!stopCond() || escaped)) {
      if (escaped) {
        escaped = false
      } else if (doEscaping) {
        escaped = c === '\\'
      }

      buff += c
      advance(1)
    }
  }
877830
function isCharVowel(char = '', includeY = true) {
  if (isEmpty(char)) return false;
  const regexp = includeY ? /[aeiouy]/ : /[aeiou]/;
  return char.toLowerCase().charAt(0).search(regexp) !== -1;
}
1097758
public static String escape(String value) {
        for (int i = 0; i < value.length(); i++) {
            if (isEscapingChar(value.charAt(i))) {
                return doEscape(value.getBytes(StandardCharsets.UTF_8), i);
            }
        }
        return value;
    }
153349
def _is_punctuation(self, char):
        """"""
        cp = ord(char)
        # We treat all non-letter/number ASCII as punctuation.
        # Characters such as "^", "$", and "`" are not in the Unicode
        # Punctuation class but we treat them as punctuation anyways, for
        # consistency.
        group0 = cp >= 33 and cp <= 47
        group1 = cp >= 58 and cp <= 64
        group2 = cp >= 91 and cp <= 96
        group3 = cp >= 123 and cp <= 126
        if (group0 or group1 or group2 or group3):
            return True
        cat = unicodedata.category(char)
        if cat.startswith('P'):
            return True
        return False
1332557
function isSafeString(str) {
      var escape = ['&amp;', '&lt;', '&gt;', '&quot;', '&#x27;', '&#96;'];
      if (typeof str !== "string" || (escape.some(function(specialChar) {
        return str.indexOf(specialChar) >= 0;
      }))) {
        return true;
      }
    }
263760
function needsHexEscape(character) {
  return !((0x00020 <= character && character <= 0x00007E) ||
           (0x00085 === character)                         ||
           (0x000A0 <= character && character <= 0x00D7FF) ||
           (0x0E000 <= character && character <= 0x00FFFD) ||
           (0x10000 <= character && character <= 0x10FFFF));
}
246681
def escape(s, quote=True):
    
    assert not isinstance(s, bytes), 'Pass a unicode string'
    if quote:
        return s.translate(_escape_map_full)
    return s.translate(_escape_map)
981908
public static String escapeString(String value, boolean noBackslashEscapes) {
    if (!value.contains("'")) {
      if (noBackslashEscapes) {
        return value;
      }
      if (!value.contains("\\")) {
        return value;
      }
    }
    String escaped = value.replace("'", "''");
    if (noBackslashEscapes) {
      return escaped;
    }
    return escaped.replace("\\", "\\\\");
  }
876359
def invalid_characters(self, text):
        """"""
        return ''.join(sorted(set([c for c in text if c not in self.alphabet])))
935457
def shell_escape(s):
    
    """
    if isinstance(s, PosixPath):
        s = unicode_(s)
    elif isinstance(s, bytes):
        s = s.decode('utf-8')
    if not s or any(c not in safe_shell_chars for c in s):
        return '"%s"' % (s.replace('\\', '\\\\')
                          .replace('"', '\\"')
                          .replace('`', '\\`')
                          .replace('$', '\\$'))
    else:
        return s
1316717
function _isQuote(c, escape, quote) {
        if (escape === "\\") {
            return false;
        }
        if (quote !== undefined) {
            return c === quote;
        }
        return c === "\"" || c === "'";
    }
214162
private static boolean hasUnsafeChars(String s) {
        for (int i = 0; i < s.length(); ++i) {
            char c = s.charAt(i);
            if (Character.isLetter(c) || c == '.')
                continue;
            else
                return true;
        }
        return false;
    }
227576
def _escape(self, value):
        """"""
        if isinstance(value, SafeString):
            return value

        return shellescape.quote(value)
1080907
def _is_punctuation(char):
    """"""
    cp = ord(char)
    # We treat all non-letter/number ASCII as punctuation.
    # Characters such as "^", "$", and "`" are not in the Unicode
    # Punctuation class but we treat them as punctuation anyways, for
    # consistency.
    if ((cp >= 33 and cp <= 47) or (cp >= 58 and cp <= 64) or
            (cp >= 91 and cp <= 96) or (cp >= 123 and cp <= 126)):
        return True
    cat = unicodedata.category(char)
    if cat.startswith("P"):
        return True
    return False
1256661
private static boolean isSafeFilenameCharacter(char c)
	{
		if (Character.isLetterOrDigit(c))
		{
			return true;
		}
		else if (c == '-' || c == '_' || c == '.')
		{
			return true;
		}
		else
		{
			return false;
		}
	}
125434
def _escape(self, s):
        
        for ch, r_ch in self.ESCAPE_SETS:
            s = s.replace(ch, r_ch)
        return s