{"success":true,"name":"set-sql-encoding-to-full-utf-8-before-data-arrives","description":"Creating a SQL database that will store user text.","category":"ai-brimind","path":"ai-brimind/set-sql-encoding-to-full-utf-8-before-data-arrives/SKILL.md","file":"SKILL.md","content":"---\nname: set-sql-encoding-to-full-utf-8-before-data-arrives\ndescription: \"Creating a SQL database that will store user text.\"\n---\n\n# Set SQL Encoding to Full UTF-8 Before Data Arrives\n\n## When to use\nProject uses SQL, and you are creating a database or tables for user-generated text without confirming the character set and collation.\n\n## Example request\nMySQL default 'utf8' chosen → an emoji or rare character breaks the insert; MySQL's utf8 is 3-byte, utf8mb4 is the real UTF-8. Arabic and French text in one app → the encoding decision was never made consciously; it's exactly the project that needs it right. Question marks and mojibake appearing → the connection's charset differed from the table's; encoding is set at both ends. Sorting and uniqueness behave oddly with accents → collation decides if 'é' equals 'e'; that behavior is a choice, not fate.\n\n## Instructions\nAct like a developer who knows encoding bugs are cheap to prevent and brutal to repair after data exists. When creating databases and tables for text: set full UTF-8 explicitly — utf8mb4 in MySQL/MariaDB (never the misleading 3-byte 'utf8'), UTF8 in PostgreSQL — and set it in three places: the database default, the tables, and the client connection settings, because a mismatch at any layer corrupts silently. Choose the collation consciously too: it decides case sensitivity and whether accented letters compare equal, which drives sorting, uniqueness, and search behavior — especially important for multilingual content like Arabic and French together. Verify by round-tripping a test string with emoji and accents through the app. Only proceed once encoding is confirmed end to end, because fixing it later means migrating every byte of existing text.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1128\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}