Encoding
Incomplete Data When Using Base64 to Decode JWT Playload
· β˜• 2 min read
When Base64-decoding a JWT, I found that the JSON data was incomplete. This article mainly introduces the relevant knowledge and solves this problem. 1. Introduction to JWT JWT passes authentication by setting Authorization: Bearer <token> in the Header. A JWT Token is a Base64-encoded string joined by dots, something like

Using utf8mb4 in Django to Support Emoji
· β˜• 3 min read
1. What Is utf8 In theory, utf8 uses 1-6 characters, In practice, the latest utf8 specification uses only one to four bytes, and can encode at most 21 bits, which is exactly enough to represent all 17 Unicode planes. 2. What Is utf8mb4 utf8mb4 is a superset of utf8. In theory, if you were using utf8 before and then change the charset to utf8mb4, it will not cause any problem when reading the existing utf8-encoded data.

Base64 Encoding
· β˜• 2 min read
1. Application Scenarios 1.1 Mail RFC821 requires that email content be ASCII. When a message contains other non-ASCII characters or binary data, Content-Transfer-Encoding is needed, and Base64 is one such method. 1.2 URL Some applications need to put binary data into a URL, but URLs only allow a specific set

Getting Started with Character Encoding in Python
· β˜• 3 min read
Background: I had just finished a Django data-query web project. The data came from internal API queries, and every query had to call several APIs to fetch the data and render it on the front-end page. Since the relevant data does not change often, I designed a cache to improve