mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 10:48:53 +00:00
AK: Add URL::to_string_encoded()
The result of to_string() passed to urlencode(), with some characters excluded - basically like JavaScript's encodeURI().
This commit is contained in:
parent
50e3b122c7
commit
e0066ff2d7
Notes:
sideshowbarker
2024-07-18 22:41:41 +09:00
Author: https://github.com/linusg
Commit: e0066ff2d7
Pull-request: https://github.com/SerenityOS/serenity/pull/5206
1 changed files with 6 additions and 0 deletions
6
AK/URL.h
6
AK/URL.h
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
|
#include <AK/URLParser.h>
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
|
@ -63,6 +64,11 @@ public:
|
||||||
|
|
||||||
String basename() const;
|
String basename() const;
|
||||||
String to_string() const;
|
String to_string() const;
|
||||||
|
String to_string_encoded() const
|
||||||
|
{
|
||||||
|
// Exclusion character set is the same JS's encodeURI() uses
|
||||||
|
return urlencode(to_string(), "#$&+,/:;=?@");
|
||||||
|
}
|
||||||
|
|
||||||
URL complete_url(const String&) const;
|
URL complete_url(const String&) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue