escapeUser function

String escapeUser(
  1. String user
)

Hex-escape a SIP URI user. Don't hex-escape ':' (%3A), '+' (%2B), '?' (%3F"), '/' (%2F).

Used by 'normalizeTarget'.

Implementation

String escapeUser(String user) => encodeURIComponent(decodeURIComponent(user))
    .replaceAll(RegExp(r'%3A', caseSensitive: false), ':')
    .replaceAll(RegExp(r'%2B', caseSensitive: false), '+')
    .replaceAll(RegExp(r'%3F', caseSensitive: false), '?')
    .replaceAll(RegExp(r'%2F', caseSensitive: false), '/');