如何打开 Visual Studio 中的特殊 Ascii 字符?

How can I turn on special Ascii characters in Visual Studio?

或更具体地说。 Ascii 控制字符。 ^C0x03STX。 我试图让我的程序在 IRC 中发送颜色代码(我知道这并没有真正的标准),但我至少花了一个小时进行研究,我不知道还能搜索什么。我在 VS 2010 的选项中没有看到任何内容。

Link to ascii reference.

我只需要让 VS 不再愚蠢,让我在文本编辑器中输入 STX 或 ETX 字符。我确实已经尝试过另存为中的编码。有什么想法或想法吗?

您可以使用转义序列对任何字符进行编码:

string s = "\x03"; // note: hexadecimal value

虽然在技术上至少可以直接在字符串中获取一些特殊字符,但由于无法正确显示它们,因此完全没有希望理解它们。

完整列表(从 this page 滑动):

\' - single quote, needed for character literals
\" - double quote, needed for string literals
\ - backslash
[=11=] - Unicode character 0
\a - Alert (character 7)
\b - Backspace (character 8)
\f - Form feed (character 12)
\n - New line (character 10)
\r - Carriage return (character 13)
\t - Horizontal tab (character 9)
\v - Vertical quote (character 11)
\uxxxx       - Unicode escape sequence for character with hex value xxxx
\xn[n][n][n] - Unicode escape sequence for character with hex
               value nnnn (variable length version of \uxxxx)
\Uxxxxxxxx   - Unicode escape sequence for character with hex
               value xxxxxxxx (for generating surrogates)