Handling auf "\n" linebreaks

Hi,
it seems the editor does not handle a "\n" as expected - the code is displayed on one line.
I ran into this situation because I exported code snippets to xml and reimported them again.
I will add a newline replacement code to work around this.

Best regards

Wolfgang
Hello Wolfgang,
Could you please provide an xml file with code snippets that cause editor to not not handles \n as expected?
regards,
Andrew
Hi Andrew,
the xml import is done by ourself, it is not part of your code ;-). The situation occured because I exported/imported our code to an xml file, and it seems that xml standard defines "\n" for linebreaks in CDATA sections.
I created a sample that is based on the "SnippetParsers" sample: in the method "GetVBCode", I just replace all "\r\n" with "\n" and you will see that the code is displayed on one line.
Here is the sample: https://www.hg-online.de/downloads/SnippetsParsersNewline.zip
It would be great if the editor could "normalize" those code fragment itself to avoid trouble. Compilation of the code containing the "\n" linebreaks using the .NET integrated CodeDomProvider works.
Best regards
Wolfgang
By the way: the subject should read "Handling of \n linebreaks", the "auf" is German and does not make sense here ;-)...
Hello Wolfgang,
This issue related to the demo project.
You should use this code:
string[] lines = StringItem.Split(text);
instead of:
string[] stringSeparators = new string[] { "\r\n" };
string[] lines = text.Split(stringSeparators, StringSplitOptions.None);
regards,
Andrew
Many thanks, this does the trick! Sorry, I should have noticed this myself.
Thanks for the help!
Wolfgang