Topic: unicode
-
SMS pitfalls: GSM-7 versus UCS-2 encoding and message segments
An SMS carries 140 bytes: 160 GSM-7 characters or 70 UCS-2 characters. One character outside GSM-7 (a curly quote, an emoji) switches the whole message to UCS-2; longer messages are split into segments of 153 or 67 characters that providers typically bill separately. Count segments before sending and normalise punctuation.
-
Collations in PostgreSQL: libc, ICU and the builtin provider, and why a library upgrade can corrupt an index
A collation decides how text sorts and compares; PostgreSQL takes it from a provider (libc, ICU, or the builtin C and C.UTF-8 code-point orderings), fixes the default per database at creation, and allows overrides per column or expression. Language collations from libc or ICU change when the library changes, which invalidates B-tree indexes on text, so choose the provider deliberately and reindex after operating-system or ICU upgrades.
-
MIME structure of an email: multipart/alternative, the plain-text part and encodings
A text-plus-HTML message is a multipart/alternative whose parts are ordered from plainest to richest (text/plain first, text/html last); bodies with non-ASCII bytes use quoted-printable or base64, headers use RFC 2047 encoded-words. Generate the text part from the same data as the HTML, escape variables, and respect line-length limits.
Machine-readable: JSON