Sharepoint - ddwrt:EcmaScriptEncode Explained?

Well, basically it calls this method SPHttpUtility.EcmaScriptStringLiteralEncode. As far as that method goes, I'm not really sure. According to the msdn article, you can go to a website that explains what ecma is.

Or if this helps, here is the reflected code:

private static readonly ushort[] ScriptCharMap = new ushort[] { 
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 3, 0, 0, 4, 5, 6, 7, 8, 0, 9, 0, 0, 0, 10, 
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 12, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0
     };
private static readonly string[] ScriptEncodedChars = new string[] { "", @"\n", @"\r", @"\u0022", @"\u0025", @"\u0026", @"\u0027", @"\u0028", @"\u0029", @"\u002b", @"\u002f", @"\u003c", @"\u003e", @"\\" };

public static void EcmaScriptStringLiteralEncode(string scriptLiteralToEncode, TextWriter output)
{
    int num;
    int num2;
    int length;
    int num4;
    if (scriptLiteralToEncode != null)
    {
        if (scriptLiteralToEncode.Length == 0)
        {
            return;
        }
        if (output != null)
        {
            num = 0;
            num2 = 0;
            length = scriptLiteralToEncode.Length;
            num4 = 0;
            goto Label_0058;
        }
    }
    return;
Label_0058:
    if (num4 < length)
    {
        int index = scriptLiteralToEncode[num4];
        if (index <= 0x7f)
        {
            ushort num5;
            if (index < 0x5f)
            {
                num5 = ScriptCharMap[index];
            }
            else
            {
                num5 = 0;
            }
            if (num5 <= 0)
            {
                num2++;
            }
            else
            {
                if (num2 > 0)
                {
                    output.Write(scriptLiteralToEncode.Substring(num, num2));
                    num2 = 0;
                }
                num = num4 + 1;
                output.Write(ScriptEncodedChars[num5]);
            }
        }
        else
        {
            if (num2 > 0)
            {
                output.Write(scriptLiteralToEncode.Substring(num, num2));
                num2 = 0;
            }
            num = num4 + 1;
            output.Write(@"\u");
            int num7 = index >> 8;
            if (num7 != 0)
            {
                if (num7 >= 0x10)
                {
                    output.Write(num7.ToString("X", CultureInfo.InvariantCulture));
                }
                else
                {
                    output.Write('0');
                    output.Write(num7.ToString("X", CultureInfo.InvariantCulture));
                }
            }
            else
            {
                output.Write("00");
            }
            num7 = index & 0xff;
            if (num7 >= 0x10)
            {
                output.Write(num7.ToString("X", CultureInfo.InvariantCulture));
            }
            else
            {
                output.Write('0');
                output.Write(num7.ToString("X", CultureInfo.InvariantCulture));
            }
        }
    }
    else
    {
        if (num < length)
        {
            output.Write(scriptLiteralToEncode.Substring(num));
        }
        return;
    }
    num4++;
    goto Label_0058;
}