How do i represent CRLF using Hex in C#?
-
Not sure why, but it's 0x0d, 0x0a, aka "\r\n".
sixlettervariables : @Jonathan: maybe he wants something like ASCIIEncoding.GetBytes(Environment.NewLine) ? -
\r\n... ie.
Console.Write("This is a test of CRLF. \r\n This is on the next line.");
-
@jonathan because that's the ascii codes they correlate too. 10 and 13
-
Hm... What about Environment.NewLine?
-
Is there any reason for CRLF specifically? In most cases Environment.NewLine is a better bet http://msdn.microsoft.com/en-us/library/system.environment.newline.aspx
-
Unicode / Non Unicode ? I think this question needs more info.
Also, Environment.NewLine is the best thing to use for portability.
-
What is the significance of doing it in hex?
-
When i use ASCII encoding to read a string having \r\n, for some reason that i do not understand, it strips out the \r, so i want to try inserting a CR LF using hex
-
Since no one has actually given the answer requested, here it is:
"\x0d\x0a"
-
In my case, the significance of doing it in Hex is that I don't want it to change depending on the platform my application is run on. I'm writing to a bank transaction file that requires all file records to terminate in CRLF.
Thanks go to the op and poster for the question and answer.
0 comments:
Post a Comment