base64_encode¶
base64_encode encodes data into the base64 format
-
ssData = base64_encode(data)
Return Value
ssData is a base64 coded string.
Parameters
-
data
data is a string or real vector of bytes (values in the range from 0 to 255).
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 mem_unpack, utf_to_locale or utf8_encode before you call base64_encode.
Example
see also base64_decode.
* 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€
History
Version | Description |
---|---|
5.0.0 | Unicode |
See also
id-240306