Adam Sh
Adam Sh

Reputation: 8577

What's the ASCII character code for '—'?

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?

Upvotes: 50

Views: 141454

Answers (8)

Mark Boulton
Mark Boulton

Reputation: 11

It's 150. You can replace Chr(150) with a normal hyphen, Chr(45).

Upvotes: 1

Alt + 0151 seems to do the trick—perhaps it doesn't work on all keyboards.

Upvotes: 2

Kino
Kino

Reputation: 121

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.

Upvotes: 11

MadDog
MadDog

Reputation: 7

alt-196 - while holding down the 'Alt' key, type 196 on the numeric keypad, then release the 'Alt' key

Upvotes: -6

Neuron
Neuron

Reputation: 5841

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.

Upvotes: 3

thb
thb

Reputation: 14454

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.

Upvotes: 4

vcsjones
vcsjones

Reputation: 141668

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.

Upvotes: 19

Li0liQ
Li0liQ

Reputation: 11264

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.

Upvotes: 61

Related Questions