🔗 URL Kodeerija/Dekodeerija

Tehke URL-id veebis ohutuks kasutades protsentkodeerimist (Percent-encoding).

URL Kodeerimise Kontseptsioon

Spetsiaalsed märgid või tühikud hüperlingis rikuvad sageli sisu transporti HTTP standardil, asendusprotokoll teisaldab pahalased hexa formaadi peale protsentidega.

Põhilised URL Muutused

  • Tühik → %20: Vältimaks viite murdumist tühja koha järelt. Spaces in URLs become %20 or +
  • & → %26: Tagab, et sisaldust ei loeta automaadselt järgmiseks käsuks Ampersand is encoded to avoid confusion with query separators
  • = → %3D: Säilitab tekkinud andmed Equals sign is encoded in values to prevent parsing issues
  • / → %2F: Suurepärane kaitsma alamkaustade loomis sassi meneku vastu Forward slash encoded when it's part of a value, not a path separator

Converts special URL characters to percent-encoded format ensuring valid URLs with spaces, Unicode, and special characters.

Key Facts

  • Defined in RFC 3986
  • Space: %20 or + in forms
  • Max URL length ~2048 chars in most browsers
  • Unicode is first UTF-8 encoded, then percent-encoded

Frequently Asked Questions

What is URL encoding?

Replaces unsafe chars with % + hex value. Space=%20, &=%26. URLs only support limited ASCII set.

Which chars need encoding?

Spaces, &, =, ?, #, and non-ASCII. Letters, digits, -_.~ are safe.

encodeURI vs encodeURIComponent?

encodeURI preserves URL structure chars (:/?#). encodeURIComponent encodes everything for query params.