Index: src/test/java/com/xpn/xwiki/render/XWikiRadeoxRendererTest.java
===================================================================
--- src/test/java/com/xpn/xwiki/render/XWikiRadeoxRendererTest.java	(revision 10382)
+++ src/test/java/com/xpn/xwiki/render/XWikiRadeoxRendererTest.java	(working copy)
@@ -223,4 +223,35 @@
         String result = renderer.render("\\[NotALink\\]", contentDocument, document, context);
         assertEquals("&#91;NotALink&#93;", result);
     }
+
+    public void testTable() throws Exception
+    {
+        String result = renderer.render("{table}\nA\n{table}", contentDocument, document, context);
+        assertEquals("<table class=\"wiki-table\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><th>A</th></tr></table>", result);
+    }
+
+    public void testTableEmptyTable() throws Exception
+    {
+        String result = renderer.render("{table}\n{table}", contentDocument, document, context);
+        assertEquals("<table class=\"wiki-table\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr></tr></table>", result);
+    }
+
+    public void testTableWithCR() throws Exception
+    {
+        String result = renderer.render("{table}\nA\\\\B\n{table}", contentDocument, document, context);
+        assertEquals("<table class=\"wiki-table\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><th>A<br/>B</th></tr></table>", result);
+    }
+
+    public void testTableWithCRWithSpace() throws Exception
+    {
+        String result = renderer.render("{table}\nA\\\\ \n{table}", contentDocument, document, context);
+        assertEquals("<table class=\"wiki-table\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><th>A<br/></th></tr></table>", result);
+    }
+
+    public void testTableWithCRWithoutSpace() throws Exception
+    {
+        String result = renderer.render("{table}\nA\\\\\n{table}", contentDocument, document, context);
+        assertEquals("<table class=\"wiki-table\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><th>A<br/></th></tr></table>", result);
+    }
+
 }
Index: src/main/java/com/xpn/xwiki/render/macro/TableMacro.java
===================================================================
--- src/main/java/com/xpn/xwiki/render/macro/TableMacro.java	(revision 10382)
+++ src/main/java/com/xpn/xwiki/render/macro/TableMacro.java	(working copy)
@@ -52,7 +52,13 @@
 
     if (null == content) throw new IllegalArgumentException("TableMacro: missing table content");
 
-    content = content.trim() + "\n";
+    // We need to check for \\ at the end of a line and preserve the white space
+    // otherwise we will fail to render the table properly
+    if (content.endsWith("\\\\ \n"))
+     content = content.trim() + " ";
+    else
+     content = content.trim();
+    content = content + "\n";
 
     Table table = TableBuilder.build(content);
     table.calc(); // calculate macros like =SUM(A1:A3)
Index: src/main/java/com/xpn/xwiki/render/macro/TableBuilder.java
===================================================================
--- src/main/java/com/xpn/xwiki/render/macro/TableBuilder.java	(revision 10382)
+++ src/main/java/com/xpn/xwiki/render/macro/TableBuilder.java	(working copy)
@@ -46,7 +46,7 @@
             }
             if ("\n".equals(token)) {
                 // Handles "\n" - "|\n"
-                lastToken = lastToken.trim();
+                lastToken = (lastToken==null) ? "" : lastToken;
                 if (!lastToken.endsWith("\\")) {
                     if (null == lastToken || "|".equals(lastToken)) {
                         table.addCell(" ");
@@ -54,23 +54,23 @@
                     table.newRow();
                 } else {
                     String cell = lastToken;
-                    while (cell.trim().endsWith("\\")) {
+                    while (cell.endsWith("\\")) {
                         token = tokenizer.nextToken();
                         if (!"|".equals(token))  {
-                            cell = cell.trim() + token;
+                            cell = cell + token;
                         } else break;
                     }
                     table.addCell(cell);
                 }
             } else if (!"|".equals(token)) {
-                if (!token.trim().endsWith("\\")) {
+                if (!token.endsWith("\\")) {
                     table.addCell(token);
                 }
             } else if ("|".equals(token)) {
                 if (null == lastToken || "|".equals(lastToken)) {
                     // Handles "|" "||"
                     table.addCell(" ");
-                } else if (lastToken.trim().endsWith("\\")){
+                } else if (lastToken.endsWith("\\")){
                      table.addCell(lastToken);
                 }
             }
