From 5c4c06665c23d9b8fe3d6a47e15d0b3f6daee368 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 14 Apr 2011 08:46:09 -0400
Subject: [PATCH] - Fixed vcard folding: use one space, use mb_regex_encoding() (#1487868)

---
 program/include/rcube_vcard.php |    6 +++---
 program/include/iniset.php      |    5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/program/include/iniset.php b/program/include/iniset.php
index 192de79..a6c4666 100755
--- a/program/include/iniset.php
+++ b/program/include/iniset.php
@@ -74,9 +74,10 @@
 @set_time_limit(120);
 
 // set internal encoding for mbstring extension
-if(extension_loaded('mbstring'))
+if (extension_loaded('mbstring')) {
     mb_internal_encoding(RCMAIL_CHARSET);
-
+    @mb_regex_encoding(RCMAIL_CHARSET);
+}
 
 /**
  * Use PHP5 autoload for dynamic class loading
diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php
index b2ad436..086313c 100644
--- a/program/include/rcube_vcard.php
+++ b/program/include/rcube_vcard.php
@@ -467,16 +467,16 @@
   {
     // use mb string function if available
     if (function_exists('mb_ereg_replace')) {
-      return ":\n  " . mb_ereg_replace('(.{70})', "\\1\n  ", $matches[1]);
+      return ":\n " . mb_ereg_replace('(.{70})', "\\1\n ", $matches[1]);
     }
     
     // chunk_split string and avoid lines breaking multibyte characters
     $c = 66;
-    $out = ":\n  " . substr($matches[1], 0, $c);
+    $out = ":\n " . substr($matches[1], 0, $c);
     for ($n = $c; $c < strlen($matches[1]); $c++) {
       // break if length > 70 or mutlibyte character starts after position 66
       if ($n > 70 || ($n > 66 && ord($matches[1][$c]) >> 6 == 3)) {
-        $out .= "\n  ";
+        $out .= "\n ";
         $n = 0;
       }
       $out .= $matches[1][$c];

--
Gitblit v1.9.1