XSLT and your mother don’t speak C#

Being an integration specialist is never dull.

I am going to excerpt from an IM chat with one of the programmers on my team, about an SSIS package we are developing.

I got:
A package of type Policy, labelled as ECWISE\XXX 2009-07-03 15:33:17.940, FAILED during its run from 2009-07-03 to 2009-07-03.\r\nHere is the error information: \r\n"\r\n—————————————————-Please do not reply to this automated message.

why the \r\n escaped in the mail?
i used the xslt to transform the xml column into a string variable, and later i use this variable as the MailMessage.Body
how do you set message body on the Send Mail task?
i'm using the script task and using the smtpclient
You put in the carriage return and newline escaped in your body, what do you expect?
i expect a real new line
Why? That's ridiculous. what do you mean by "real"?
I expect:

Here is the error information: C:\temp31 does not exist!
Please do not reply to this automated message.

Something like that.

I mean: why do you use the word "real"…
What makes \r\n "real" to you?
Think about it.


At this point, everybody who knows me can tell this is a verbatim conversation, right?

To continue:

I used the wrong word, sorry.
No, don't say "sorry". Figure it out!
Why is \r\n "real"?
Think why you said it.
they are only characters, why are they "real" ?
\r\n is real because…
I thought they are carriage return in text
Really? If you are writing a letter to your mother, and you write \n\r does she interpret it as lf cr?
The letter is text.
[A long pause here]
When you wrote that string in your code what did you do?
did you write x + "\r\n" + y in the script task?
I'm doing it in XSLT, so concat(x, "\r\n", y)
That is utterly ridiculous.
Let me ask you about your mother again
Does she read \r\n as CRLF?
That's right, never.

So why do *you* read it that way? Why does it seem "real" to you?

I will tell you why, but you will kick yourself… It's because you are a C# programmer .

\r\n is not "real. It is just a convention in some languages. There is nothing "real" about it.
Your mother and XSLT don't speak C#.


It's not XSLT's fault, or your mother's.

In XSLT he ended  up using <xsl:text> to force a line break in his text e-mail message. That's okay, but please note you can use properly encoded entity references to create a CRLF in XSLT, just like you can in C#. 

As an interesting side-note, this project was being written in SSIS 2005. SSIS 2005 script tasks don't speak C# either. So, even if we were not using XSLT to formulate the message from the XML source containing the error information, we would have to use a VB convention, not \r\n, to get the job done.

If he were sending the message body as HTML rather than text for this error notice, he'd have to use <BR/>. SSIS 2005 script and HTML are two more environments that don't understand \r\n.

There's always a way to do it. But there is nothing inherently "real" about \r\n, no matter a person who is single-language-centric might think.

I want to be fair and say that this particular programmer is usually very agile-minded as we hook differently-abled types of code to each other in an integrated application. I'm not pointing him out in particular.

We live in the Matrix

I'm trying to say: in the world we live in now, nobody can afford to be language-centric.  I'm trying to say: none of this is real. 

Use what's best for the customer and best for the product. Don't get hung up on what's cool or what a vendor recommends.  Don't get freaked out by the little places, like representation of characters, that are different in each environment. 

Just take a breath, get your bearings, you'll find the right "words" in the right dialect. If what you're trying to express is important, have a little faith and realize there's a way to do it, in any language, no matter where in the world you are. 

And be careful out there.