Index: Source/core/inspector/InspectorFrontendHost.cpp |
diff --git a/Source/core/inspector/InspectorFrontendHost.cpp b/Source/core/inspector/InspectorFrontendHost.cpp |
index 04d53529857bf85a59f12195c2651b3a24ce445f..2c0023898804d25599d66b08bc49a0af5a8a0a57 100644 |
--- a/Source/core/inspector/InspectorFrontendHost.cpp |
+++ b/Source/core/inspector/InspectorFrontendHost.cpp |
@@ -166,10 +166,27 @@ void InspectorFrontendHost::sendMessageToBackend(const String& message) |
m_client->sendMessageToBackend(message); |
pfeldman
2014/03/04 11:45:46
Lets use it here as well.
yurys
2014/03/04 12:15:35
Done.
|
} |
+static String escapeUnicodeNonCharacters(const String& str) |
+{ |
+ StringBuilder dst; |
+ for (unsigned i = 0; i < str.length(); ++i) { |
+ UChar c = str[i]; |
+ if (c < 32 || c > 126) { |
+ unsigned symbol = static_cast<unsigned>(c); |
+ String symbolCode = String::format("\\u%04X", symbol); |
+ dst.append(symbolCode); |
+ } else { |
+ dst.append(c); |
+ } |
+ |
+ } |
+ return dst.toString(); |
+} |
+ |
void InspectorFrontendHost::sendMessageToEmbedder(const String& message) |
{ |
if (m_client) |
- m_client->sendMessageToEmbedder(message); |
+ m_client->sendMessageToEmbedder(escapeUnicodeNonCharacters(message)); |
} |
void InspectorFrontendHost::showContextMenu(Event* event, const Vector<ContextMenuItem>& items) |