mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibJS: Add FIXMEs to a few functions that need UTF-16 handling
This commit is contained in:
parent
979e02c0a8
commit
248b79d687
Notes:
sideshowbarker
2024-07-19 04:40:31 +09:00
Author: https://github.com/nico
Commit: 248b79d687
Pull-request: https://github.com/SerenityOS/serenity/pull/2852
Reviewed-by: https://github.com/awesomekling
2 changed files with 8 additions and 1 deletions
|
@ -251,6 +251,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::atob)
|
|||
auto string = interpreter.argument(0).to_string(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
// FIXME: This should convert string from a byte string to LibJS's internal string encoding (UTF-8).
|
||||
auto decoded = decode_base64(StringView(string));
|
||||
return JS::js_string(interpreter, String::copy(decoded));
|
||||
}
|
||||
|
@ -265,6 +266,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::btoa)
|
|||
auto string = interpreter.argument(0).to_string(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
// FIXME: This should convert string to a non-UTF-8 byte string first.
|
||||
auto encoded = encode_base64(StringView(string));
|
||||
return JS::js_string(interpreter, String::copy(encoded));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue