When a phone number’s leading plus sign becomes a space in an API request, inspect the encoding boundary before changing the number. Compare the original string, serialized request and server-parsed value to find the first change. Removing the prefix can hide the defect while creating a different recipient value.

Find the format used at that boundary
Query strings, form bodies and JSON bodies do not share identical parsing rules. Under form-style encoding, a plus sign can represent a space. A literal plus must be represented appropriately by the serializer. MDN’s URLSearchParams documentation describes this distinction and warns about constructing parameters from strings containing plus signs.
This is not a rule that every plus in every HTTP request changes. Identify the content type and the client library’s documented behaviour. A JSON field containing a plus is a different boundary from a raw query parameter parsed as form data. Copying a workaround from one into the other can introduce another error.
Compare three representations of a harmless value
Use a clearly non-operational fixture in an isolated test. Keep the original application string, the serialized request parameter and the server’s parsed value. The comparison should show where the first change occurs, without contacting a real number or exposing an API credential.
| Representation | What to establish |
|---|---|
| Application value | The intended characters remain intact |
| Serialized request | The encoding matches the documented endpoint |
| Parsed field | The receiver obtains the original value |
A debugging tool may display a decoded parameter beside an encoded request. Establish which view you are reading before declaring them inconsistent. A screenshot of a prettified field is not always evidence of the raw bytes transmitted.
Encode once, at the correct layer
Pass the unencoded value to a standard parameter serializer when that is the client’s contract. Hand-encoding the plus and then handing the result to another encoder can produce double encoding. The server may receive encoded text instead of the intended character.
There is an important distinction between adding a raw name-and-value pair and parsing a preassembled parameter string. In the first case, the parameter API can serialize the literal plus appropriately; in the second, it may already be interpreting a plus as a space. Identify which operation your code performs. This makes the fix concrete without changing the recipient or adding a second manual decoding step.
Do not fix the symptom by replacing every space in every input with a plus. That can corrupt legitimate data and leave the original serialization bug unresolved. Keep the correction scoped to the request construction and use tests for both the literal plus and ordinary fields.
Once the value survives the boundary unchanged, validate the provider’s actual number-format requirement. Correct encoding does not establish ownership, receiving capability or acceptance by a target verification service. Those are separate conditions to check through the authorised workflow.
A useful regression test compares the round-trip value through the real client and parser without sending a message. It should also cover a plain value that needs no special treatment. Retain the non-sensitive fixture and expected parsed result so a later library change can be checked at the same boundary, rather than repeatedly modifying a live phone number until a request passes.
Technical reference: MDN: URLSearchParams and percent encoding.
