Skip to content

misc: Added SDL_EncodeURL. - #16263

Open
icculus wants to merge 1 commit into
libsdl-org:mainfrom
icculus:sdl3-urlencode
Open

misc: Added SDL_EncodeURL.#16263
icculus wants to merge 1 commit into
libsdl-org:mainfrom
icculus:sdl3-urlencode

Conversation

@icculus

@icculus icculus commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator
  • I confirm that I am the author of this code and release it to the SDL project under the zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

Adds a way to encode URL strings, for use with SDL_OpenURL(), etc. Generally you would encode either just the params and append them to a URL ("https://example.com?my_param=" + SDL_EncodeURL(SomeUntrustedString, NULL)), or the whole string for a file:/// path (file:/// + SDL_EncodeURL(SomeUntrustedPath, "\\/")).

Can be seen in action with:

./test/testurl file:///Some Path/That Has Spaces --urlencode --no-encode-chars ':/'

(Although strictly speaking, you would want to encode the path with just '/' in no-encode-chars and prepend "file://" directly, but this is just a test program.)

Fixes #16254.

@icculus icculus added this to the 3.6.0 milestone Sep 7, 2026
@icculus icculus self-assigned this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] open folder in file browser

1 participant