How to print string exactly as it is read from a file?

时间:2019-04-16 22:14:05

标签: c# .net

I read this string:

"\u0093 Safe area to answer the phone\u0094."

But when i want to send or rewrite in files, it appears like this:

" Safe area to answer the phone."

I need to print the original string.

1 个答案:

答案 0 :(得分:-1)

The \u0093 is just how the C# language represents unprintable characters. It's called "escaping". So what's being printed is actually what's in the file. A more popular example is that a newline shows up as '\n'. See Can I convert a C# string value to an escaped string literal for a code snippet on how to do what the C# language is doing and print the escape characters.