Web TippsUse custom web fonts in Google Sheets charts(08.09.2026 um 17:05 Uhr)
Web TippsIntroducing the new 1Password App for Google Chat(08.09.2026 um 18:02 Uhr)
Web TippsUse custom web fonts in Google Sheets charts(08.09.2026 um 17:05 Uhr)
Web TippsIntroducing the new 1Password App for Google Chat(08.09.2026 um 18:02 Uhr)

🔧 Programmierung 🕛 vor 3 Monaten 3 Min Lesezeit
0

URL Encoding Explained: Special Characters and How to Handle Them

↗ Quelle (dev.to)
🗣️ Stimme:




URL Encoding Explained: Special Characters and How to Handle Them




CODE
    📅 May 25, 2026⏱️ 7 min read🔗 Network Tools


Every character in a URL has a meaning. Spaces, ampersands, question marks, and non-ASCII characters must be encoded or they'll break your links. This guide explains how URL encoding works and when to use it.

## Why URLs Need Encoding

URLs were designed to be read by computers, not humans. A URL like `https://example.com/search?q=hello world` contains a space — which is technically illegal in URLs. Browsers display it for convenience, but the actual encoded URL is `https://example.com/search?q=hello%20world`.

The `%20` is URL encoding. Every character outside the "safe" set gets replaced with `%XX` where XX is its hexadecimal ASCII value.

## The Safe Character Set

These characters don't need encoding in URLs:







CODE
  ```




A-Z a-z 0-9 - _ . ~




CODE

plaintext

Everything else — spaces, punctuation, non-ASCII characters, special symbols — must be percent-encoded.

## Common Encodings You Should Know



```
space → %20 ! → %21 " → %22 # → %23
$ → %24 % → %25 & → %26 ' → %27 ( → %28
) → %29 * → %2A + → %2B , → %2C / → %2F
: → %3A ; → %3B = → %3D ? → %3F @ → %40
[ → %5B ] → %5D { → %7B } → %7C | → %7C







CODE
  ## Query Parameters vs Path Segments

Different parts of a URL have different encoding rules:


- **Path segments** (e.g., `/blog/my post`) — encode everything except unreserved characters

- **Query string keys and values** (e.g., `?q=hello`) — encode using application/x-www-form-urlencoded

- **Query string separators** — `?`, `&`, and `=` are reserved and should not be encoded when they're serving as separators



## Common Mistakes to Avoid

### Mistake 1: Double Encoding

If a parameter value already contains encoded data, encode it again and you'll get double-encoding:







CODE
  ```




User's input: "hello%20world"

Wrong (double encode): "hello%2520world"

Right (single encode): "hello%20world"




CODE

plaintext

Use your framework's built-in URL encoding functions rather than manual string replacement.

### Mistake 2: Encoding Already Encoded URLs

Never encode a full URL — only encode the dynamic parts (query values, path segments with user content). The protocol, host, and structural characters must remain unencoded.

### Mistake 3: Forgetting Non-ASCII Characters

Chinese characters, emoji, accented letters — all must be UTF-8 encoded then percent-encoded:



```
"你好" → UTF-8 bytes → %E4%BD%A0%E5%A5%BD







CODE
  JavaScript's `encodeURIComponent()` handles this correctly. Plain `encodeURI()` does not encode most non-ASCII characters.

## URL Encoding in Different Languages







CODE
  ```




JavaScript: encodeURIComponent(str) // for query values

encodeURI(str) // for full URLs



Python: urllib.parse.quote(s) // RFC 3986

urllib.parse.urlencode(dict) // query string



Node.js: encodeURIComponent(str) // same as JS

qs.stringify(obj) // for query objects




CODE

plaintext

## Base64URL — URL-Safe Base64

Standard Base64 uses `+` and `/`, which are unsafe in URLs. Base64URL replaces these:



```
Base64: + → + / → / = (padding)
Base64URL: + → - / → _ = (removed)







CODE
  Used in JWT tokens and URL-safe data transmission.

## Try It Yourself

Use our [URL Encoder tool](../../tools/dev/url-encoder.html) to encode or decode any URL component. The tool automatically handles special characters, query strings, and non-ASCII text.


Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
Use custom web fonts in Google Sheets charts
2 Quellen
Introducing the new 1Password App for Google Chat
1 Quelle
Context-aware access controls are available for Gemini Enterprise in the Admin console
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten URL Encoding Explained: Special Characters and How to Handle Them

Thematisch verwandte Begriffe: Encoding, Explained, Special, Characters · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...