Closed leoutnlp closed 7 years ago
Not sure what you're asking.
I edit an xml file with a Windows text editor and a line break that in windows is \ r \ n when importing the file and parsing it with mustache removes the line break only if it is run from a Windows. Running from a linux removes the \ n but \ r converts it to a blank space. Example: Running C sharp application in Windows: When generating with Mustache it converts \ r \ n to an empty string = ""
Running C sharp application on Linux: When generating with Mustache convert \ r \ n to a string = " "
Are you working with a version that's been ported to .NET core, perhaps?
On May 16, 2017 7:06 PM, "leoutnlp" notifications@github.com wrote:
I edit an xml file with a Windows text editor and a line break that in windows is \ r \ n when importing the file and parsing it with mustache removes the line break only if it is run from a Windows. Running from a linux removes the \ n but \ r converts it to a blank space. Example: Running C sharp application in Windows: When generating with Mustache it converts \ r \ n to an empty string = ""
Running C sharp application on Linux: When generating with Mustache convert \ r \ n to a string = " "
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/jehugaleahsa/mustache-sharp/issues/77#issuecomment-301939770, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTgPiJFooHX9L4Jc0smOOop3TtlLfDxks5r6ivfgaJpZM4NczC7 .
If I use the .net core version
I'm struggling to follow you, but I can tell you this: inside the
StaticGenerator
class, it uses Environment.NewLine
, which is going to
be \r\n
on Windows. What that evaluates to on other platforms I don't
know. It sounds like on Linux it's using \n
, leaving the \r
around.
On May 16, 2017 7:10 PM, "leoutnlp" notifications@github.com wrote:
If I use the .net core version
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jehugaleahsa/mustache-sharp/issues/77#issuecomment-301940468, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTgPv8Z70jtakd_eQhUwfrYKWl4QVmOks5r6izugaJpZM4NczC7 .
I tell you what I did to solve it both in windows and linux, before passing the string by mustache I do the following: String text = ... text = text.Replace ("\ r \ n", ""); FormatCompiler compiler = new FormatCompiler (); Generator generator = compiler.Compile (text);
So, in linux the \ n takes it as a line break and deletes it but \ r does not know how to interpret it and turns it into a blank space.
I have an xml file with line breaks generated from a windows system that works fine on windows but running it from a linux causes an error in my software. Deleting the line break \ r \ n from the xml on a linux operating system removes the \ n but in the \ r leaves a blank space.