github_url: | hide |
---|
Inherits: :ref:`Object<class_Object>`
Data transformation (marshaling) and encoding helpers.
.. rst-class:: classref-introduction-group
Provides data transformation and encoding utility functions.
.. rst-class:: classref-reftable-group
.. rst-class:: classref-section-separator
.. rst-class:: classref-descriptions-group
.. rst-class:: classref-method
:ref:`PackedByteArray<class_PackedByteArray>` base64_to_raw ( :ref:`String<class_String>` base64_str )
Returns a decoded :ref:`PackedByteArray<class_PackedByteArray>` corresponding to the Base64-encoded string base64_str
.
.. rst-class:: classref-item-separator
.. rst-class:: classref-method
:ref:`String<class_String>` base64_to_utf8 ( :ref:`String<class_String>` base64_str )
Returns a decoded string corresponding to the Base64-encoded string base64_str
.
.. rst-class:: classref-item-separator
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` base64_to_variant ( :ref:`String<class_String>` base64_str, :ref:`bool<class_bool>` allow_objects=false )
Returns a decoded :ref:`Variant<class_Variant>` corresponding to the Base64-encoded string base64_str
. If allow_objects
is true
, decoding objects is allowed.
Internally, this uses the same decoding mechanism as the :ref:`@GlobalScope.bytes_to_var<class_@GlobalScope_method_bytes_to_var>` method.
Warning: Deserialized objects can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats such as remote code execution.
.. rst-class:: classref-item-separator
.. rst-class:: classref-method
:ref:`String<class_String>` raw_to_base64 ( :ref:`PackedByteArray<class_PackedByteArray>` array )
Returns a Base64-encoded string of a given :ref:`PackedByteArray<class_PackedByteArray>`.
.. rst-class:: classref-item-separator
.. rst-class:: classref-method
:ref:`String<class_String>` utf8_to_base64 ( :ref:`String<class_String>` utf8_str )
Returns a Base64-encoded string of the UTF-8 string utf8_str
.
.. rst-class:: classref-item-separator
.. rst-class:: classref-method
:ref:`String<class_String>` variant_to_base64 ( :ref:`Variant<class_Variant>` variant, :ref:`bool<class_bool>` full_objects=false )
Returns a Base64-encoded string of the :ref:`Variant<class_Variant>` variant
. If full_objects
is true
, encoding objects is allowed (and can potentially include code).
Internally, this uses the same encoding mechanism as the :ref:`@GlobalScope.var_to_bytes<class_@GlobalScope_method_var_to_bytes>` method.