If needed, mime encodes the name part

@param {String} name Name part of an address
@returns {String} Mime word encoded string if needed
 /* eslint-disable node/no-deprecated-api /* eslint-disable no-control-regex
963157
function encodeAddressName(name) {
  if (!/^[\w ']*$/.test(name)) {
    if (/^[\x20-\x7e]*$/.test(name)) {
      return '"' + name.replace(/([\\"])/g, '\\$1') + '"';
    } else {
      return (0, _emailjsMimeCodec.mimeWordEncode)(name, 'Q');
    }
  }
  return name;
}
1323258
public static String decode(String name)
   {
      // quick check
      if (name.indexOf("_x") < 0)
      {
         // not encoded
         return name;
      }
      StringBuffer decoded = new StringBuffer();
      Matcher m = ENCODE_PATTERN.matcher(name);
      while (m.find())
      {
         m.appendReplacement(decoded, Character.toString((char)Integer.parseInt(m.group().substring(2, 6), 16)));
      }
      m.appendTail(decoded);
      return decoded.toString();
   }
1251121
function convertFieldName (name) {
  const regex = new RegExp(/\.|\(|\)/g)
  return name.replace(regex, '').replace(/\s/g, '_')
}
935745
@Deprecated
    public static String encode(String name, String value) {
        return io.netty.handler.codec.http.cookie.ClientCookieEncoder.LAX.encode(name, value);
    }
812944
public String fullyQualifiedSymbolName(String name) {
        if (name.equals(SymbolsTable.ME)) {
            return "$".concat(id());
        } else if (name.startsWith("$")) {
            return "$" + id() + '.' + name.substring(1);
        }
        return id() + '.' + name;
    }
146530
private static String utf8Name(final String name) {
    final Matcher matcher = pattern.matcher(name);
    if (!matcher.matches())
      return name;
    if (matcher.group(2).isEmpty())
      return matcher.group(1);
    return matcher.group(1) + getSubscript(matcher.group(2));
  }
239247
public static InternalQName encode(InternalQName name)
   {
      String encoded = encode(name.getName());
      if (encoded.equals(name.getName()))
      {
         return name;
      }
      else
      {
         return new InternalQName(name.getNamespace(), encoded);
      }
   }
880099
function findCompressionByName(encodingName) {
        for (var i = 0; i < compressions.length; i++) {
            if (compressions[i].encodingName === encodingName)
                return compressions[i];
        }
        return null;
    }
1249082
public static String getUnderlineName(String name) {
        if (StringUtils.isBlank(name)) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < name.length(); i++) {
            char c = name.charAt(i);
            if (i > 0 && Character.isUpperCase(c)) {
                sb.append("_");
            }
            sb.append(c);
        }
        return sb.toString().toLowerCase();
    }
384434
@Nullable
    public static Compression valueOf(final String name) {
        final String actualName = name.trim().toUpperCase();
        for (final Compression compression : register) {
            if (compression.name.equals(actualName)) {
                return compression;
            }
        }
        Preconditions.checkNotNull(name);
        return null;
    }
351565
function _gpfWebGetNamespaceAndName (name) {
    var EXPECTED_PARTS_COUNT = 2,
        NAMESPACE_PREFIX = 0,
        NAME = 1,
        parts = name.split(":");
    if (parts.length === EXPECTED_PARTS_COUNT) {
        return {
            namespace: _gpfWebGetNamespace(parts[NAMESPACE_PREFIX]),
            name: parts[NAME]
        };
    }
}
241848
function (name) {
    // pre-test to improve performance
    if (REGEXP_IS_ESCAPED.test(name)) {
        name = name.replace(REGEXP_DOT, '.');
        name = name.replace(REGEXP_DOLLAR, '$');
        name = name.replace(REGEXP_TO_BSON, 'toBSON');
        name = name.replace(REGEXP_BSON_TYPE, '_bsontype');
    }

    return name;
}
857774
function getName(name) {
    const ext = path.extname(name);
    
    const nameCrypt = crypto.createHash('sha1')
        .update(name)
        .digest('hex') + ext;
    
    return getDir() + nameCrypt;
}
664996
function XName(name) {
        if (TypeUtils.isNullOrUndefined(name)) {
            throw "Name cannot be (null) or (undefined)!";
        }
        name = ('' + name).trim();
        var ns = null;
        var ln = name;
        if (ln.indexOf(':') > -1) {
            var parts = ln.split(':');
            if (2 !== parts.length) {
                throw "Cannot have more than one separator!";
            }
            ns = parts[0].trim();
            ln = parts[1].trim();
        }
        if ('' === ln) {
            throw "Local name cannot be empty!";
        }
        if (null !== ns) {
            ns = ns.trim();
            if ('' === ns) {
                ns = null;
            }
        }
        this._namespace = ns;
        this._localName = ln;
    }
455662
function(name) {
		var cookie = document.cookie, e, p = name + "=", b;

		if ( !cookie )
			return;

		b = cookie.indexOf("; " + p);

		if ( b == -1 ) {
			b = cookie.indexOf(p);

			if ( b != 0 )
				return null;

		} else {
			b += 2;
		}

		e = cookie.indexOf(";", b);

		if ( e == -1 )
			e = cookie.length;

		return decodeURIComponent( cookie.substring(b + p.length, e) );
	}
1216023
protected static String nameToId(String name) {
        try {
            return URLEncoder.encode(name, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            // should not happen
            throw new RuntimeException("Unsupported encoding", e);
        }
    }
158086
public static String toSafeFileName(String name) {
        int size = name.length();
        StringBuilder builder = new StringBuilder(size * 2);
        for (int i = 0; i < size; i++) {
            char c = name.charAt(i);
            boolean valid = c >= 'a' && c <= 'z';
            valid = valid || (c >= 'A' && c <= 'Z');
            valid = valid || (c >= '0' && c <= '9');
            valid = valid || (c == '_') || (c == '-') || (c == '.');

            if (valid) {
                builder.append(c);
            } else {
                // Encode the character using hex notation
                builder.append('x');
                builder.append(Integer.toHexString(i));
            }
        }
        return builder.toString();
    }