<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/javascript-uri-parameter-encoding-bxkluezhe" -->

---
title: JavaScript URI parameter encoding | daily.dev
description: A developer troubleshooting Swedish character encoding issues in an Ajax library found that JavaScript's deprecated encode() function failed to properly encode...
canonical: https://daily.dev/posts/javascript-uri-parameter-encoding-bxkluezhe
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: JavaScript URI parameter encoding | daily.dev
og:description: A developer troubleshooting Swedish character encoding issues in an Ajax library found that JavaScript's deprecated encode() function failed to properly encode...
og:url: https://daily.dev/posts/javascript-uri-parameter-encoding-bxkluezhe
og:image: https://api.daily.dev/og/posts/bxklueZhE.png
og:image:alt: JavaScript URI parameter encoding
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript URI parameter encoding

**[Maarten Balliauw](https://daily.dev/sources/maartenballiauw)** · 1 min read · 0 upvotes · 0 comments

## Summary

A developer troubleshooting Swedish character encoding issues in an Ajax library found that JavaScript's deprecated encode() function failed to properly encode non-ASCII characters like å, ä, ö, while switching to encodeURIComponent() resolved the problem by translating more characters correctly.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.maartenballiauw.be/posts/2006-08-21-javascript-uri-parameter-encoding>

## Questions this post answers

### why are special characters like å and ö getting mangled when I send them from JavaScript to my server

The deprecated JavaScript encode() function does not properly translate many non-ASCII characters such as å, ä, and ö, causing them to be passed incorrectly between client and server. Switching to encodeURIComponent() resolves the issue because it encodes a wider range of characters correctly, even when the server already sends a UTF-8 header.

_Developers debugging character encoding mismatches can find similar troubleshooting write-ups on daily.dev._

## Similar posts on daily.dev

- [My Favorite Bugs: Invalid Surrogate Pairs](https://daily.dev/posts/my-favorite-bugs-invalid-surrogate-pairs-qzculkzdx) · Hacker News · 0 upvotes · 0 comments
- [URL Anatomy & Encoding: Why Your Payloads Break](https://daily.dev/posts/url-anatomy-encoding-why-your-payloads-break-t88gzybop) · InfoSec Write-ups · 0 upvotes · 0 comments
- [Two characters open up a world of typosquatting opportunities in Chromium browsers](https://daily.dev/posts/two-characters-open-up-a-world-of-typosquatting-opportunities-in-chromium-browsers-qqpad6deq) · The Register · 0 upvotes · 0 comments
- [Exploiting Unvalidated Redirects for XSS](https://daily.dev/posts/exploiting-unvalidated-redirects-for-xss-qkw7sjhxj) · This is Learning · 0 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/javascript-uri-parameter-encoding-bxkluezhe)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"JavaScript URI parameter encoding","url":"https://daily.dev/posts/javascript-uri-parameter-encoding-bxkluezhe","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/javascript-uri-parameter-encoding-bxkluezhe"},"datePublished":"2026-10-04T13:06:54.861Z","dateModified":"2026-10-04T13:10:52.492Z","description":"A developer troubleshooting Swedish character encoding issues in an Ajax library found that JavaScript's deprecated encode() function failed to properly encode...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/228b835b838455e19339255a74e7b2c5?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/228b835b838455e19339255a74e7b2c5?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Maarten Balliauw","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Maarten Balliauw","logo":"https://media.daily.dev/image/upload/s--rOTg3VYO--/f_auto,q_auto/v1791119043/logos/maartenballiauw?_a=BAMAMicg0","url":"https://daily.dev/sources/maartenballiauw"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/javascript-uri-parameter-encoding-bxkluezhe","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Maarten Balliauw","item":"https://daily.dev/sources/maartenballiauw"},{"@type":"ListItem","position":3,"name":"JavaScript URI parameter encoding"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/javascript-uri-parameter-encoding-bxkluezhe#faq","mainEntity":[{"@type":"Question","name":"why are special characters like å and ö getting mangled when I send them from JavaScript to my server","acceptedAnswer":{"@type":"Answer","text":"The deprecated JavaScript encode() function does not properly translate many non-ASCII characters such as å, ä, and ö, causing them to be passed incorrectly between client and server. Switching to encodeURIComponent() resolves the issue because it encodes a wider range of characters correctly, even when the server already sends a UTF-8 header. Developers debugging character encoding mismatches can find similar troubleshooting write-ups on daily.dev."}}]}
```

