1

I am trying to print out the following string using std::cout :

"Encryptor –pid1 0x34f –pid2"

the '-' characters appear as u's with a circumflex above them (I'm not sure how to type this).

How do I print out the hyphen as intended?

1
  • 1
    that's not hyphen. you can use some hex editor to check its real value. my editor shows it's 0xa843 Commented Feb 22, 2011 at 12:36

2 Answers 2

1

That was not a hyphen.

It was a "n-dash", which will render differently across consoles based on encoding settings.

The hyphen key is usually on the number row of your keyboard, on Western layouts.

Sign up to request clarification or add additional context in comments.

Comments

1

Make sure your terminal's idea of the character encoding matches that of your source code. How to do this, of course, depends on your operating system, which terminal emulator (assuming it's an emulator at all) you're using, and so on, neither of which you state.

Also, that's not a hyphen in your example, it's too long. It's probably an "em dash".

2 Comments

I see. How can I find out what my terminal's idea of the character encoding is? Where would I have set the character encoding of my source code...?
You're right - that wasn't a hyphen. I wanted a hyphen, so I've changed the source code. Thanks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.