I am working on decoding text. I am trying to find the character code for the —
character, not to be mistaken for -
, in ASCII. I have tried unsuccessfully. Does anybody know how to convert it?
Quotation from wiki (Em dash)
When an actual em dash is unavailable—as in the ASCII character set—a double ("--") or triple hyphen-minus ("---") is used. In Unicode, the em dash is U+2014 (decimal 8212).
Em dash character is not a part of ASCII character set.
char check = s.charAt(0)
, when s = —
, what I will get? Do you say that if I will do int check = s.charAt(0)
, I will get 8212? –
Maronite s = '\u2014'
–
Riane —
is known as an Em Dash. It's character code is \u2014
. It is not an ASCII character, so you cannot decode it with the ASCII character set because it is not in the ASCII character table. You would probably want to use UTF8 instead.
\u2014
as you said. –
Riane Windows For Windows on a keyboard with a Numeric keypad:
Use Alt+0150 (en dash), Alt+0151 (em dash), or Alt+8722 (minus sign) using the numeric keypad.
This character does not exist in ASCII, but only in Unicode, usually encoded by UTF-8.
In UTF-8, characters are encoded by 2- or 3-byte sequences (or occasionally longer), where none of the two or three bytes is a valid ASCII code, where all of them are outside the ASCII range of 0 through 127.
One suspects that the foregoing only partly answers your question, but if so then this is probably because your question is, inadvertently, only partly asked. For further details, you can extend your question with more specifics.
The character —
is not part of the ASCII set.
But if you are looking to convert it to some other format (like U+hex), you can use this online tool. Put your character into the first green box and click "Convert" (above the box)
further below you'll find a number of different codes, including U+hex:
U+2014
Feel free to edit this answer if the link breaks or leave a comment so I can find a replacement.
Alt + 0151 seems to do the trick—perhaps it doesn't work on all keyboards.
It's 150. You can replace Chr(150) with a normal hyphen, Chr(45).
alt-196 - while holding down the 'Alt' key, type 196 on the numeric keypad, then release the 'Alt' key
"—".codePointAt(0).toString(16)
) –
Colver © 2022 - 2024 — McMap. All rights reserved.
mdash
is represented with number 151. – Unfeeling