Take the 2-minute tour ×

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?

share|improve this question
What do you mean by 'decode this char'? What encoding is used in the source text, and what encoding should be used in the result? –  raina77ow Apr 27 '12 at 20:54
@raina77ow: I try to find the number of this char in Ascii table –  Adam Sh Apr 27 '12 at 20:54
It's not there; therefore, its code depends on what encoding is used. For example, in Latin-1 texts mdash is represented with number 151. –  raina77ow Apr 27 '12 at 20:57

3 Answers 3

up vote 7 down vote accepted

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.

share|improve this answer
So when I do: 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? –  Adam Sh Apr 27 '12 at 20:57
@AdamSh It depends on what you are using to do the decoding. You didn't post any code, so it is hard to tell. Commonly when a decoder encounters something it can't decode it replaces it with a question mark. –  vcsjones Apr 27 '12 at 21:01
You should either throw an exception or start using bigger integers and return 8212. –  Li0liQ Apr 27 '12 at 21:31

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.

share|improve this answer

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.

share|improve this answer

Your Answer


