From 6647c4013586fb375fd6241f507383bf3df10386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Tue, 13 Apr 2010 17:44:09 +0000 Subject: [PATCH] Configurable character set for vCard exports --- addressbook/inc/class.addressbook_hooks.inc.php | 16 ++++++++++++++++ addressbook/inc/class.addressbook_vcal.inc.php | 10 +++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php index 49505795b8..32cf3246dc 100644 --- a/addressbook/inc/class.addressbook_hooks.inc.php +++ b/addressbook/inc/class.addressbook_hooks.inc.php @@ -175,6 +175,22 @@ class addressbook_hooks 'default'=> 'iso-8859-1', ); + $selectCharSet = array( + 'utf-8' => 'UTF-8', + 'iso-8859-1' => 'ISO-8859-1', + ); + + $settings['vcard_charset'] = array( + 'type' => 'select', + 'label' => 'Charset for the vCard export', + 'name' => 'vcard_charset', + 'values' => $selectCharSet, + 'help' => 'Which charset should be used for the vCard export.', + 'xmlrpc' => True, + 'admin' => false, + 'default'=> 'utf-8', + ); + if ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap') { $settings['private_addressbook'] = array( diff --git a/addressbook/inc/class.addressbook_vcal.inc.php b/addressbook/inc/class.addressbook_vcal.inc.php index 66a04c1476..9c1c89108c 100644 --- a/addressbook/inc/class.addressbook_vcal.inc.php +++ b/addressbook/inc/class.addressbook_vcal.inc.php @@ -980,9 +980,17 @@ class addressbook_vcal extends addressbook_bo { return false; } + if (isset($GLOBALS['egw_info']['user']['preferences']['addressbook']['vcard_charset'])) + { + $charset = $GLOBALS['egw_info']['user']['preferences']['addressbook']['vcard_charset']; + } + else + { + $charset = 'utf-8'; + } foreach ($ids as $id) { - fwrite($fp,$this->getVCard($id)); + fwrite($fp,$this->getVCard($id, $charset)); } fclose($fp);