Problem with encoding in WRT
authorAdam Banasiak <a.banasiak@samsung.com>
Tue, 17 Sep 2013 13:27:47 +0000 (15:27 +0200)
committerHoseon LEE <hoseon46.lee@samsung.com>
Mon, 14 Oct 2013 11:19:23 +0000 (20:19 +0900)
[Issue#] WGL-427
[Problem] No validation of default encoding in WRT
[Cause] N/A
[Solution] Add encoding validation to WRT. Set default encoding to UTF-8
[Verification]
1. Build repository
2. Download (http://cam.sprc.samsung.pl/secure/attachment/42428/e7.wgt) and install e7.wgt
3. Launch the widget

Change-Id: I317ebec5bc37d62b41b778166469f6d153d045df

src/view/webkit/view_logic.cpp

index 3a3d750..2f98736 100644 (file)
@@ -787,14 +787,20 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView)
     OptionalWidgetStartFileInfo fileInfo =
         W3CFileLocalization::getStartFileInfo(m_model->TizenId);
     if (!fileInfo.IsNull()) {
-        encoding = DPL::ToUTF8String((*fileInfo).encoding);
-        LogDebug("Found custom encoding in DB: " << encoding);
+            std::string file_encoding = DPL::ToUTF8String((*fileInfo).encoding);
+
+            if(EINA_TRUE == ewk_settings_is_encoding_valid(
+                                                        file_encoding.c_str())){
+                encoding = file_encoding;
+                _D("Found custom encoding in DB: %s", encoding.c_str());
+            }
+
     }
-    LogDebug("Setting encoding: " << encoding);
+    _D("Setting encoding: %s", encoding.c_str());
     if (ewk_settings_default_encoding_set(settings,encoding.c_str())) {
-        LogDebug("Encoding set properly");
+        _D("Encoding set properly");
     } else {
-        LogError("Error while setting encoding");
+        _E("Error while setting encoding");
     }
 
 #ifdef CSP_ENABLED