Marshalls.base64_to_utf8 not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Spyrex

Hello guys,
with this code, I am trying to get an image asset converted to a string. But the output of the following code is empty.

var img = Marshalls.variant_to_base64(load("res://assets/image.jpg"), true)
img = Marshalls.base64_to_utf8(img)

Any idea?

:bust_in_silhouette: Reply From: Foreman21

Hi Marshalls.base64_to_utf8 is for decoding a string encoded in base64.

var base64_str = "SGVsbG8gdGhlIHdvcmxkIQ=="
var decoded_str =  Marshalls.base64_to_utf8(base64_str)
# Hello the world!

See Marshalls.base64_to_variant to decode your variant.