mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +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:
committed by
Andreas Kling
parent
50e3b122c7
commit
e0066ff2d7
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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user