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..f05cbc18e93431a116fa8aed4dce40deed1e2953 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,16 @@ bool SpellingServiceClient::RequestTextCheck( |
&language_code, |
&country_code); |
+ // Replace typographical apostrophes with typewriter apostrophes, so that |
+ // server word breaker behaves correctly. |
+ const base::char16 kApostrophe = 0x27; |
+ const base::char16 kRightSingleQuotationMark = 0x2019; |
+ base::string16 text_copy = text; |
+ std::replace(text_copy.begin(), text_copy.end(), kRightSingleQuotationMark, |
+ kApostrophe); |
+ |
// 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[] = |
"{" |