How do I avoid double URL encoding when rendering URLs in my website?

The %2520 in “New%2520Tiddler.html” suggests that the space character is being encoded twice.

Are you experiencing issues with double encoding in your TiddlyWiki links, particularly when generating a static website with Node.js? If so, could you provide more details or specific code snippets where the double encoding problem occurs? This will help in diagnosing the issue and providing a more accurate solution.

You are correct in your diagnosis:

charcode=32 --> urlencode --> %20 --> urlencode --> %2520

OR...

" " --> urlencode --> %20 --> urlencode --> %2520

Is that what you did when the problem appeared? Report a bug on GitHub.

There’s no bug here.

We use URL encoding for the filenames of static file exports to ensure that all possible titles map onto a filepath that is legal under all operating systems.

The double encoding occurs because these paths must also be encoded when they appear as URLs.

In other words, if one has a tiddler called + then the filepath might be %43. That filepath then gets URL encoded a further time in order to be able to represent it within a URL (where % needs to be encoded).