Code Explainers
Code explainers tagged #encoding
go
package handlers import ( "encoding/base64"
Cursor pagination in a Gin handler
pagination
cursor
rest-api
Intermediate
8 steps
ruby
require "charlock_holmes" class TextFileNormalizer DEFAULT_CONFIDENCE = 60
Normalizing text files to clean UTF-8 in Ruby
encoding
text-processing
file-io
Intermediate
8 steps
rust
use base64::engine::general_purpose::{STANDARD, URL_SAFE_NO_PAD}; use base64::{DecodeError, Engine}; pub fn encode_standard(data: &[u8]) -> String {
Base64 encode and decode in Rust
base64
encoding
error-handling
Beginner
7 steps
ruby
require "base64" require "json" module Attachment
Packing binary attachments into JSON
serialization
base64
json
Intermediate
8 steps
java
public final class BomAwareReader { private static final char UTF8_BOM = '\uFEFF';
Skipping the UTF-8 byte-order mark in Java
file-io
encoding
byte-order-mark
Intermediate
6 steps
java
public URI buildSearchUri(String query, int page, int size, List<String> tags) { UriComponentsBuilder builder = UriComponentsBuilder .fromUriString("https://api.example.com") .path("/v2/products/search")
Building URIs safely with UriComponentsBuilder in Spring
url-building
builder-pattern
encoding
Intermediate
5 steps
go
package render import ( "net/http"
How Gin renders MsgPack responses
serialization
content-type
interface-implementation
Intermediate
5 steps
python
from pathlib import Path import chardet
Reading text files of unknown encoding in Python
encoding
byte-order-mark
fallback
Intermediate
8 steps
php
<?php function parseMultipartEmail(string $raw): array {
Parsing multipart emails with mailparse
mime-parsing
email
encoding
Intermediate
9 steps
ruby
require "zlib" require "stringio" require "base64"
Compress-and-encode payloads in Ruby
compression
encoding
io-streams
Intermediate
8 steps
go
package token import ( "crypto/rand"
Generating secure random tokens in Go
cryptography
randomness
encoding
Intermediate
5 steps
javascript
function parseJwtPayload(token) { const parts = token.split('.'); if (parts.length !== 3) { throw new Error('Invalid JWT: expected 3 segments');
Decoding a JWT payload in JavaScript
jwt
base64url
encoding
Intermediate
6 steps