Replace non-breaking spaces in HtmlParser

Previously, trim() would not catch non-breaking spaces and they would
get added to the comments. Later on, non-breaking spaces get converted
to regular spaces yielding empty comments and comments that are not
trimmed correctly.

Change-Id: Ie1cd4e37a3f946e16a51e9db5d36ef1e0ee3bf5c
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/receive/HtmlParser.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/receive/HtmlParser.java
index 20e163e..9e04f89 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/receive/HtmlParser.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/receive/HtmlParser.java
@@ -90,7 +90,8 @@
           && elementName.equals("div")
           && !e.className().startsWith("gmail")) {
         // This is a comment typed by the user
-        String content = e.ownText().trim();
+        // Replace non-breaking spaces and trim string
+        String content = e.ownText() .replace('\u00a0', ' ').trim();
         if (!Strings.isNullOrEmpty(content)) {
           if (lastEncounteredComment == null && lastEncounteredFileName == null) {
             // Remove quotation line, email signature and
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/mail/receive/HtmlParserTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/mail/receive/HtmlParserTest.java
index 7d729bc..11bc4ff 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/mail/receive/HtmlParserTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/mail/receive/HtmlParserTest.java
@@ -41,7 +41,7 @@
     b.htmlContent(
         newHtmlBody(
             "Looks good to me",
-            "I have a comment on this.",
+            "I have a comment on this. ",
             null,
             "Also have a comment here.",
             null,