Tutorial by Examples: decoding

Note: these examples use the variables created in the Quick Start: Encoding section above. # url1: http%3A%2F%2Ftest.com%3Ftest%3Dmy%20value [uri]::UnescapeDataString($url1) # Returns: http://test.com?test=my value # url2: http://test.com?test=my%20value [uri]::UnescapeDataString($url2) # Re...
To include the base64 module in your script, you must import it first: import base64 The base64 encode and decode functions both require a bytes-like object. To get our string into bytes, we must encode it using Python's built in encode function. Most commonly, the UTF-8 encoding is used, howeve...
The base64 module also includes encoding and decoding functions for Base32. These functions are very similar to the Base64 functions: import base64 # Creating a string s = "Hello World!" # Encoding the string into bytes b = s.encode("UTF-8") # Base32 Encode the bytes e = b...
The base64 module also includes encoding and decoding functions for Base16. Base 16 is most commonly referred to as hexadecimal. These functions are very similar to the both the Base64 and Base32 functions: import base64 # Creating a string s = "Hello World!" # Encoding the string into...
Adobe created it's own encoding called ASCII85 which is similar to Base85, but has its differences. This encoding is used frequently in Adobe PDF files. These functions were released in Python version 3.4. Otherwise, the functions base64.a85encode() and base64.a85encode() are similar to the previous...
Just like the Base64, Base32, and Base16 functions, the Base85 encoding and decoding functions are base64.b85encode() and base64.b85decode(): import base64 # Creating a string s = "Hello World!" # Encoding the string into bytes b = s.encode("UTF-8") # Base85 Encode the byte...
import Json.Decode as JD import Json.Decode.Pipeline as JP type PostType = Image | Video type alias Post = { id: Int , postType: PostType } -- assuming server will send int value of 0 for Image or 1 for Video decodePostType: JD.Decoder PostType decodePostType = JD.int |&...

Page 2 of 2