.. highlightlang:: us .. index:: base64_encode .. _base64_encode: base64_encode ============= .. us.tag base64_encode NOTREADYENGLISH New400 Changed420 Changed500 STR :ref:`base64_encode` encodes data into the base64 format .. function:: ssData = base64_encode(data) .. us.return **Return Value** *ssData* is a base64 coded string. .. us.params **Parameters** .. uparam:: data *data* is a string or real vector of bytes (values in the range from 0 to 255). .. us.comment **Comment** If a string is passed to the function, the string will be converted to a byte array. The conversion "cuts off" the high byte of the 16 bit unicode character. To include the high byte into the result, you must convert the string with :ref:`mem_unpack`, :ref:`utf_to_locale` or :ref:`utf8_encode` before you call :ref:`base64_encode`. .. us.example **Example** see also :ref:`base64_decode`. .. highlight:: none :: * r = base64_encode(s = "Hallo€") * r SGFsbG+s * base64_decode(r) Hallo¬ * mem_dump(s) 00000000 48 00 61 00 6c 00 6c 00-6f 00 ac 20 H.a.l.l.-o.. 12.0000 * r = base64_encode(s = mem_unpack("Hallo€")) * r SABhAGwAbABvAKwg * base64_decode(r) 72.0000 0.0000 97.0000 0.0000 108.0000 0.0000 108.0000 0.0000 111.0000 0.0000 -84.0000 32.0000 * base64_decode(r, 1) H\x00a\x00l\x00l\x00o\x00¬ * mem_pack(base64_decode(r, 1)) Hallo€ .. highlight:: us .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - 5.0.0 - Unicode .. seealso:: :ref:`overview-strings`, :ref:`base64_decode`, :ref:`strchar`, :ref:`strcode` :sub:`id-240306`