private void BuildDictionaryValue(StringBuilder builder, VarSpec varSpec, IDictionary <string, string> values) { var first = true; CheckCompositeVariables(varSpec); if (op.Named && !varSpec.Exploded) { builder.Append(varSpec.Name); builder.Append('='); } foreach (var item in values) { if (!first) { builder.Append(varSpec.Exploded ? op.Separator : ","); } var key = PctEncoding.Escape(item.Key, CharSpec.ExtendedSafe); builder.Append(key); builder.Append(varSpec.Exploded ? '=' : ','); BuildValue(builder, varSpec, item.Value ?? string.Empty); first = false; } }
private void BuildValue(StringBuilder builder, VarSpec varSpec, string value) { var charSpec = op.AllowReserved ? CharSpec.ExtendedSafe : CharSpec.Safe; value = PctEncoding.Escape(value, charSpec); builder.Append(value); }
public static string Escape(string name) { return(PctEncoding.Escape(name, CharSpec.VarChar)); }