Add defense code that sets default text encoding
authorjh5.cho <jh5.cho@samsung.com>
Wed, 5 Aug 2015 10:14:43 +0000 (19:14 +0900)
committerjh5.cho <jh5.cho@samsung.com>
Wed, 5 Aug 2015 10:15:29 +0000 (19:15 +0900)
Change-Id: I11798e4ccc0850d1996a42661b20ffa37f6859a6

src/runtime/web_view_impl.cc

index 7f51c1ed32b0849bff63f908e720c8076a121b88..f817339072c82253ca60f815f3d48b8e56fde5f0 100755 (executable)
@@ -789,10 +789,15 @@ void WebViewImpl::SetCSPRule(const std::string& rule, bool report_only) {
 }
 
 void WebViewImpl::SetDefaultEncoding(const std::string& encoding) {
-  if (ewk_settings_is_encoding_valid(encoding.c_str())) {
-    Ewk_Settings* settings = ewk_view_settings_get(ewk_view_);
+  Ewk_Settings* settings = ewk_view_settings_get(ewk_view_);
+
+  if (ewk_settings_is_encoding_valid(encoding.c_str()))
     ewk_settings_default_text_encoding_name_set(settings, encoding.c_str());
-  }
+  else
+    ewk_settings_default_text_encoding_name_set(settings, kDefaultEncoding);
+    // TODO(jh5.cho) : It is required to set an encoding value again to apply it
+    // to the document.characterSet for unkown reason. ewk api seems to be fixed
+
 }
 
 }  // namespace wrt