0

If I copy an Unicode encoded value as actual rendered character (for example form here - 1D400) and paste it into Notepad++, it really does show it as a "bold" character.

But when I try to manually write it in the Notepad++ as the Unicode value (typed as \u1D400) and use plugin HTML Tag > Decode JS (as advised by this post), it does not renders it into the "bold" character...and what's even worse, it converts it into different 2 characters!

Why is that and how to make Notepad++ converting the value into the same character visual as it shows it when I simply copy/paste it already rendered form a webpage?

Am I doing something wrong? Can anyone show me the proper way how would I simply write the actual Unicode value into the notepad++ and then it would converts it to the correct character?

1 Answers1

0

\u expects exactly four digits; it is limited to codepoints in the BMP (i.e. up to U+FFFF). Your input therefore gets decoded as U+1D40 followed by a regular 0.

I found on Stack Overflow that the ES6 edition of JS has the \u{...} syntax for longer codepoints, but the Notepad++ plugin does not support that yet.

(JavaScript as a whole is based on UTF-16 and only works with 16-bit code units; if it needs to represent a non-BMP character, that has to be done using a surrogate pair. The same also goes for many Windows apps, as Windows overall uses UTF-16 for its Unicode support. They both well predate the concept of Unicode extending above U+FFFF – 16 bits were once thought to be enough for everybody.)

If you're writing HTML, I suggest writing the codepoint as an HTML entity, e.g. 𝐀 (and keeping it like that in the document – no, unfortunately the NP++ plugin's "Decode HTML entities" does not accept that either – it throws away what didn't fit in 16 bits and assumes U+D400. This is despite it having plenty non-BMP codepoints in its entities.ini...)

Otherwise, use the Snippets plugin and add your commonly used characters there.

grawity
  • 501,077