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

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

Issue 145973021: Implement "replacement" text encoding. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Replacement codec should emit U+FFFD Created 6 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: Source/modules/encoding/TextEncoder.cpp
diff --git a/Source/modules/encoding/TextEncoder.cpp b/Source/modules/encoding/TextEncoder.cpp
index 741314b091a1698b05369c9ef4761e4f730e60a5..328657c7e2a9399948f5289c0de895830471e258 100644
--- a/Source/modules/encoding/TextEncoder.cpp
+++ b/Source/modules/encoding/TextEncoder.cpp
@@ -55,12 +55,12 @@ PassRefPtrWillBeRawPtr<TextEncoder> TextEncoder::create(const String& utfLabel,
return nullptr;
}
- return adoptRefWillBeNoop(new TextEncoder(encoding.name()));
+ return adoptRefWillBeNoop(new TextEncoder(encodingLabel, name));
}
-TextEncoder::TextEncoder(const String& encoding)
- : m_encoding(encoding)
- , m_codec(newTextCodec(m_encoding))
+TextEncoder::TextEncoder(const String& label, const String& name)
+ : m_encoding(name)
+ , m_codec(newTextCodec(label))
{
}
@@ -70,7 +70,7 @@ TextEncoder::~TextEncoder()
String TextEncoder::encoding() const
{
- String name = String(m_encoding.name()).lower();
+ String name = m_encoding.lower();
ASSERT(name == "utf-8" || name == "utf-16le" || name == "utf-16be");
return name;
}

Powered by Google App Engine
This is Rietveld 408576698