Index: third_party/WebKit/Source/wtf/text/WTFString.h |
diff --git a/third_party/WebKit/Source/wtf/text/WTFString.h b/third_party/WebKit/Source/wtf/text/WTFString.h |
index 0b1b4ea8fd153ea6f4baae0726940c95b34a97f1..b05dbc89a2a191a181dc02421220670d2ce28148 100644 |
--- a/third_party/WebKit/Source/wtf/text/WTFString.h |
+++ b/third_party/WebKit/Source/wtf/text/WTFString.h |
@@ -428,9 +428,10 @@ public: |
static String make16BitFrom8BitSource(const LChar*, size_t); |
- // String::fromUTF8 will return a null string if |
- // the input data contains invalid UTF-8 sequences. |
- static String fromUTF8(const LChar*, size_t); |
+ // String::fromUTF8 will return a null string if the input data contains |
+ // invalid UTF-8 sequences. When |strict| is false, isolated surrogates are |
+ // converted. |
+ static String fromUTF8(const LChar*, size_t, bool strict = true); |
static String fromUTF8(const LChar*); |
static String fromUTF8(const char* s, size_t length) { return fromUTF8(reinterpret_cast<const LChar*>(s), length); } |
static String fromUTF8(const char* s) { return fromUTF8(reinterpret_cast<const LChar*>(s)); } |
@@ -441,6 +442,10 @@ public: |
static String fromUTF8WithLatin1Fallback(const LChar*, size_t); |
static String fromUTF8WithLatin1Fallback(const char* s, size_t length) { return fromUTF8WithLatin1Fallback(reinterpret_cast<const LChar*>(s), length); } |
+ // Helper methods to call fromUTF8() with |strict| = false. |
+ static String fromUTF8Lenient(const LChar* s, size_t length) { return fromUTF8(s, length, false); } |
+ static String fromUTF8Lenient(const char* s, size_t length) { return fromUTF8Lenient(reinterpret_cast<const LChar*>(s), length); } |
+ |
bool containsOnlyASCII() const; |
bool containsOnlyLatin1() const; |
bool containsOnlyWhitespace() const { return !m_impl || m_impl->containsOnlyWhitespace(); } |