0

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.

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
eljaquez
  • 1
  • 1
  • Please add a [mcve] – Camilo Terevinto Apr 16 '19 at 22:21
  • 1
    There's something (important!) you're not telling us, and we can't guess from the information you've provided. An [MCVE] is an excellent suggestion. – paulsm4 Apr 16 '19 at 22:24
  • `\u0093` is a Unicode "Set Transmit State" character (http://www.unicode-symbol.com/u/0093.html), while `\u0094` is a "Cancel" character (http://www.unicode-symbol.com/u/0094.html). They both sound like they date back to the age of teletypes (although a teletype character with 8 (rather than 7) bits surprises me). I don't expect either is printable. What do you mean by _"it appears like this"_? – Flydog57 Apr 16 '19 at 22:44
  • Depending on what you want one of the two duplicates should solve your problem (whether you want `\t` is output or `\u000a`)… If you want other Unicode ranges to be escaped or not you'll have to adjust code in https://stackoverflow.com/a/1615860/477420 to match your exact requirements. – Alexei Levenkov Apr 16 '19 at 22:59
  • But this still begs the question where exactly the OP is seeing "\u0093". If he's just reading from a text file, and writing back exactly what he read to another text file, there should be no problem. – paulsm4 Apr 17 '19 at 00:57

1 Answers1

-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.

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
Mike S
  • 3,058
  • 1
  • 22
  • 12