Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: chrome/browser/spellchecker/spelling_service_client.cc

Issue 1092243002: Handle typographical apostrophe with spelling service client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/spellchecker/spelling_service_client.cc
diff --git a/chrome/browser/spellchecker/spelling_service_client.cc b/chrome/browser/spellchecker/spelling_service_client.cc
index a0c1381cbb9a0eb9254982a6e9b02948f5181254..405cb0291b265f4d17a4de3daa800c7a80e41335 100644
--- a/chrome/browser/spellchecker/spelling_service_client.cc
+++ b/chrome/browser/spellchecker/spelling_service_client.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/spellchecker/spelling_service_client.h"
+#include <algorithm>
+
#include "base/json/json_reader.h"
#include "base/json/string_escape.h"
#include "base/logging.h"
@@ -66,8 +68,13 @@ bool SpellingServiceClient::RequestTextCheck(
&language_code,
&country_code);
+ // Replace typographical apostrophes with typewriter apostrophes, so that
+ // server word breaker behaves correctly.
+ base::string16 text_copy = text;
+ std::replace(text_copy.begin(), text_copy.end(), L'\x2019', L'\'');
+
// Format the JSON request to be sent to the Spelling service.
- std::string encoded_text = base::GetQuotedJSONString(text);
+ std::string encoded_text = base::GetQuotedJSONString(text_copy);
static const char kSpellingRequest[] =
"{"

Powered by Google App Engine
This is Rietveld 408576698