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

Unified Diff: Source/modules/encoding/TextEncoder.cpp

Issue 1071283004: Encoding API: ignore leading/trailing whitespace in labels (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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
« no previous file with comments | « Source/modules/encoding/TextDecoder.cpp ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/encoding/TextEncoder.cpp
diff --git a/Source/modules/encoding/TextEncoder.cpp b/Source/modules/encoding/TextEncoder.cpp
index 5d3674813d54026d8a127af4188c631f81e7871c..fdb5fc5c4fbd6c3b49a1f4651409ff31baececfc 100644
--- a/Source/modules/encoding/TextEncoder.cpp
+++ b/Source/modules/encoding/TextEncoder.cpp
@@ -33,6 +33,7 @@
#include "modules/encoding/TextEncoder.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "modules/encoding/Encoding.h"
#include "wtf/text/CString.h"
#include "wtf/text/TextEncodingRegistry.h"
@@ -40,7 +41,7 @@ namespace blink {
TextEncoder* TextEncoder::create(const String& utfLabel, ExceptionState& exceptionState)
{
- WTF::TextEncoding encoding(utfLabel);
+ WTF::TextEncoding encoding(utfLabel.stripWhiteSpace(&Encoding::isASCIIWhiteSpace));
if (!encoding.isValid()) {
exceptionState.throwRangeError("The encoding label provided ('" + utfLabel + "') is invalid.");
return 0;
« no previous file with comments | « Source/modules/encoding/TextDecoder.cpp ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698