diff --git a/core/includes/config.inc b/core/includes/config.inc
index 8c2772b..d27ef50 100644
--- a/core/includes/config.inc
+++ b/core/includes/config.inc
@@ -1,6 +1,17 @@
 <?php
 
 use Drupal\Core\Config\DrupalVerifiedStorageSQL;
+use Drupal\Core\Config\DrupalConfigXMLElement;
+
+/**
+ * @todo
+ */
+const CONFIG_HTML_WRAPPER = 'addHTMLChild';
+
+/**
+ * @todo
+ */
+const CONFIG_DEFAULT_WRAPPER = 'addChild';
 
 /**
  * @file
@@ -151,7 +162,7 @@ function config_decode($data) {
   // array since SimpleXML and json_decode()/encode() are native to PHP. Our
   // only other choice would be a custom userspace implementation which would
   // be a lot less performant and more complex.
-  $xml = new SimpleXMLElement($data);
+  $xml = simplexml_load_string($data, "Drupal\Core\Config\DrupalConfigXMLElement", LIBXML_NOCDATA);
   $json = json_encode($xml);
   return json_decode($json, TRUE);
 }
@@ -167,7 +178,7 @@ function config_decode($data) {
  */
 function config_xml_to_array($data) {
   $out = array();
-  $xmlObject = simplexml_load_string($data);
+  $xmlObject = simplexml_load_string($data, "Drupal\Core\Config\DrupalConfigXMLElement", LIBXML_NOCDATA);
 
   if (is_object($xmlObject)) {
     $attributes = (array) $xmlObject->attributes();
@@ -193,6 +204,9 @@ function config_xml_to_array($data) {
  * @param $data
  *   An associative array or an object
  *
+ * @param $wrappers
+ *   An array wrappers to use for each config key
+ * 
  * @return
  *   A representation of this array or object in the native configuration
  *   format.
@@ -200,10 +214,10 @@ function config_xml_to_array($data) {
  * @todo The loaded XML can be invalid; throwing plenty of PHP warnings but no
  *   catchable error.
  */
-function config_encode($data) {
-  // Convert the supplied array into a SimpleXMLElement.
-  $xml_object = new SimpleXMLElement("<?xml version=\"1.0\"?><config></config>");
-  config_array_to_xml($data, $xml_object);
+function config_encode($data, $wrappers = array()) {
+  // Convert the supplied array into a DrupalConfigXMLElement.
+  $xml_object = new DrupalConfigXMLElement("<?xml version=\"1.0\"?><config></config>");
+  config_array_to_xml($data, $xml_object, $wrappers);
 
   // Pretty print the result.
   $dom = new DOMDocument('1.0');
@@ -224,19 +238,25 @@ function config_encode($data) {
  *   A representation of this array or object in the native configuration
  *   format.
  */
-function config_array_to_xml($array, &$xml_object) {
+function config_array_to_xml($array, &$xml_object, $wrappers = array(), $original_key = NULL, $recursion = FALSE) {
   foreach ($array as $key => $value) {
+    if ($recursion === FALSE) {
+      // If not a recursive call then save the original key so that when the
+      // value is written the correct wrapper is used 
+      $original_key = $key;
+    }
     if (is_array($value)) {
       if (!is_numeric($key)){
         $subnode = $xml_object->addChild("$key");
-        config_array_to_xml($value, $subnode);
+        config_array_to_xml($value, $subnode, $wrappers, $original_key, TRUE);
       }
       else {
-        config_array_to_xml($value, $xml_object);
+        config_array_to_xml($value, $xml_object, $wrappers, $original_key, TRUE);
       }
     }
     else {
-      $xml_object->addChild($key, $value);
+      // Add the value to the xml object using the wrapper function
+      $xml_object->$wrappers[$original_key]($key, $value);
     }
   }
 }
diff --git a/core/lib/Drupal/Core/Config/DrupalConfig.php b/core/lib/Drupal/Core/Config/DrupalConfig.php
index 9fc33aa..bd0e427 100644
--- a/core/lib/Drupal/Core/Config/DrupalConfig.php
+++ b/core/lib/Drupal/Core/Config/DrupalConfig.php
@@ -18,6 +18,8 @@ class DrupalConfig {
   protected $_verifiedStorage;
 
   protected $data = array();
+  
+  protected $wrappers = array();
 
   /**
    * Constructs a DrupalConfig object.
@@ -121,7 +123,7 @@ class DrupalConfig {
    * @param $value
    *   @todo
    */
-  public function set($key, $value) {
+  public function set($key, $value, $wrapper = CONFIG_DEFAULT_WRAPPER) {
     // Remove all non-alphanumeric characters from the key.
     // @todo Reverse this and throw an exception when encountering a key with
     //   invalid name. The identical validation also needs to happen in get().
@@ -139,6 +141,11 @@ class DrupalConfig {
     else {
       drupal_array_set_nested_value($this->data, $parts, $value);
     }
+
+    // Store the the wrapper that will be used when writing value for this key
+    // in file
+    $this->wrappers[$key] = $wrapper;
+
     return $this;
   }
 
@@ -201,7 +208,7 @@ class DrupalConfig {
    * Saves the configuration object to disk as XML.
    */
   public function save() {
-    $this->_verifiedStorage->write(config_encode($this->data));
+    $this->_verifiedStorage->write(config_encode($this->data, $this->wrappers));
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Config/DrupalConfigXMLElement.php b/core/lib/Drupal/Core/Config/DrupalConfigXMLElement.php
new file mode 100644
index 0000000..6d446a3
--- /dev/null
+++ b/core/lib/Drupal/Core/Config/DrupalConfigXMLElement.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Drupal\Core\Config;
+
+/**
+ * Represents the default configuration storage object.
+ */
+class DrupalConfigXMLElement extends \SimpleXMLElement
+{
+  /**
+   * Adds a child to the XML element wrapped in CDATA so it can contain HTML.
+   *
+   * @param $key
+   *   The configuration key.
+   *
+   * @param $value
+   *   The configuration value.
+   *
+   */
+  public function addHTMLChild($key, $value) {
+    $child = $this->addChild($key);
+    $node = dom_import_simplexml($child); 
+    $no = $node->ownerDocument; 
+    $node->appendChild($no->createCDATASection($value)); 
+  }
+}
