Copy A and ๐ into your browser console. They look like the same letter in different weights. JavaScript sees two different characters:
for (const ch of ['A', '๐']) {
console.log(ch, ch.codePointAt(0).toString(16).toUpperCase());
}
// A 41
// ๐ 1D400
U+1D400 is Mathematical Bold Capital A. A copy-and-paste text tool can swap A for ๐, and the replacement goes onto the clipboard as plain text. The font that made it look good in the preview stays behind.
The replacement is the easy part
Hereโs a small version of the mapping. It handles ASCII letters and leaves everything else alone:
function toMathBold(text) {
return Array.from(text, ch => {
const code = ch.codePointAt(0);
if (code >= 0x41 && code <= 0x5A) {
return String.fromCodePoint(0x1D400 + code - 0x41);
}
if (code >= 0x61 && code <= 0x7A) {
return String.fromCodePoint(0x1D41A + code - 0x61);
}
return ch;
}).join('');
}
console.log(toMathBold('Alex, cafรฉ! ๐'));
// ๐๐ฅ๐๐ฑ, ๐๐๐รฉ! ๐
The รฉ stays as it was because it falls outside those two ranges. PasteCharm uses the same idea of passing unmapped characters through. Some styles need explicit exceptions too. For example, the italic mapping uses โ for lowercase h, so walking a range wonโt work for every style.
The box shows up at the other end
The receiving app has to find a glyph to draw U+1D400. Its font stack can differ from your browserโs, even on the same device. If the rendering system canโt draw a character, it may show a missing-glyph box. If the app refuses to save the text, check the rules for that input field separately. Unicode FAQ on unsupported characters
A browser preview tells you how the text looks here. For a quick check, paste the same string into the actual profile field and view the saved profile. If youโre debugging someone elseโs report, ask which app and device showed the box, and which character was affected.
Style less of the string
In the PasteCharm bio builder, the first line is the display name. The converter styles that line and leaves the lines underneath alone. So a name can have a decorative accent while the sentence that tells people who you are stays in ordinary text. If the styled name shows up as boxes or sounds strange in a screen reader, the original spelling is an easy fallback.
For text that stays on a page you control, Iโd use CSS to bold normal letters. Iโd reserve these substitutions for cases where someone explicitly wants to copy the characters themselves.
This article was drafted with AI using PasteCharmโs implementation as a reference.
Top comments (0)