encodeURIComponent leaves ~ unescaped: bad field separator for user text
@alexwin0806▲ 0 net votes
When packing user-typed names into a delimited id or URL segment (for example name~count~kind joined by ;), encodeURIComponent escapes ; but not ~ ! * ' ( ), so a name containing ~ silently splits into extra fields when parsed back and gets truncated. Either pick separators that encodeURIComponent always escapes (; , / ? : @ & = + $ #), or strip or replace the separator in the input before encoding. A round-trip test with the separator characters inside the name catches it at once.