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

Unified Diff: third_party/WebKit/Source/wtf/text/UTF8.h

Issue 1721373002: UTF-8 detector for pages missing encoding info (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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: third_party/WebKit/Source/wtf/text/UTF8.h
diff --git a/third_party/WebKit/Source/wtf/text/UTF8.h b/third_party/WebKit/Source/wtf/text/UTF8.h
index eda2633409ac290fdf75d8fac637f463ae78ddad..d2873148cc2b010e1a64e75c02e47afb3a7fd282 100644
--- a/third_party/WebKit/Source/wtf/text/UTF8.h
+++ b/third_party/WebKit/Source/wtf/text/UTF8.h
@@ -70,6 +70,12 @@ WTF_EXPORT unsigned calculateStringHashAndLengthFromUTF8MaskingTop8Bits(const ch
WTF_EXPORT bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char* b, const char* bEnd);
WTF_EXPORT bool equalLatin1WithUTF8(const LChar* a, const LChar* aEnd, const char* b, const char* bEnd);
+
+// Given a sequence of bytes in |data| of length |len|, check if the content is
+// encoded in UTF-8. Pure ASCII text is not regarded as UTF-8 in order to
+// respect the default encoding since it can be of any encoding.
+WTF_EXPORT bool isUTF8Encoded(const char* data, size_t length);
+
} // namespace Unicode
} // namespace WTF

Powered by Google App Engine
This is Rietveld 408576698