Proxy URLs and percent-encoding: preserving special characters
A complete proxy URL is convenient for imports, but its components have strict boundaries. A colon, @ sign, square bracket, or percent sign may be a delimiter or data. Concatenating fields without encoding can make the client parse a different value from the one the user intended.
Key points in one minute
- The scheme identifies how to communicate with the proxy.
- Authority can contain userinfo, host, and port.
- Reserved characters used as data need percent-encoding.
- The same component must not be encoded or decoded twice.
URI components
A URI starts with a scheme, followed by an authority that commonly contains address and port. Userinfo, when supported by the client, appears before @. A parser separates components before safely decoding data inside them.
Reserved and unreserved characters
Letters, digits, and a small unreserved set can be carried directly. Delimiters such as @, colon, and percent have special meanings. When they are part of a username or password, an exporter converts the corresponding bytes to percent-encoded form.
The double-encoding failure
After encoding, the percent sign belongs to an escape sequence. Processing it again changes it to %25 and alters the credential. Store the original value and produce encoded output only at the export boundary.
Client compatibility
Chromium and curl accept defined proxy URI forms, but embedded-credential support differs. Chrome understands the scheme, host, and port while ignoring usernames and passwords embedded in manual proxy settings. Show a preview for the selected application and offer output without userinfo when credentials are entered separately.
Practical checklist
- 1Use an explicit http or socks5 scheme.
- 2Encode data only within its own component.
- 3Do not percent-encode the same value twice.
- 4Validate IPv6 brackets and port placement.
- 5Compare the output with the client's documentation.
Sources and documentation
This material is based on primary, official, and technical sources. The article is an original summary written for this knowledge base.