Use built-in php function to do what we were trying to do with str_replace
authorColeman Watts <coleman@civicrm.org>
Fri, 31 Jan 2020 16:40:26 +0000 (11:40 -0500)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:21 +0000 (19:13 -0700)
ext/afform/core/CRM/Afform/ArrayHtml.php

index 84a4ae15d4208d006f63cfc4fe1d99bde8b9db1a..464363f5bf691174c3ac3ac0f92a521bbc71d063 100644 (file)
@@ -365,11 +365,7 @@ class CRM_Afform_ArrayHtml {
    * @return string
    */
   public function replaceUnicodeChars($markup) {
-    // TODO: Potentially replace other unicode characters that can be represented as html entities
-    $replace = [
-      ["\xc2\xa0", '&nbsp;'],
-    ];
-    return str_replace(array_column($replace, 0), array_column($replace, 1), $markup);
+    return mb_convert_encoding($markup, 'HTML-ENTITIES', 'UTF-8');
   }
 
   /**