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 Answer 1

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.

4
  • To clarify what I'm doing: I want to emulate - inside the NPP - the option to post pseudo BOLD text into regular Facebook posts enabled by some external sites: I've found out that the way they're achieving it is by replacing the text that should be in bold (option normally not available for FB posts) with the Unicode value of the Mathematical Alphanumeric Symbols that visually corresponds to the individual characters from the text. My aim was to replicate this inside the NPP so that I don't need to go to some external website: I'd write what I want and simply copy/paste into FB post. Commented Mar 6 at 19:05
  • So after a while I just realized that really the best option is the last one you suggested, that is to use NPP plugin called Snippets, add all the characters there and simply use them as I need them...thank you for your help! Commented Mar 6 at 19:38
  • Then I don't think manually typing in Unicode values would be useful... The translation could probably be done using the JS plugin that allows writing custom commands (maybe even using the same translation table as those websites are using), or saving the website locally (if it's JavaScript-based then you can save it as .html). Commented Mar 6 at 19:39
  • Yea, saving the website locally might work, anyway I decided to go the manual way as described above, suggested by you in the last line of your post. :-) EDIT: no, it actually does not work as locally saved webpage, unfortunately (just tested); BTW what is the name of that supposed JS plugin, please? Commented Mar 6 at 19:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .