Configurable character set for vCard exports

This commit is contained in:
Jörg Lehrke 2010-04-13 17:44:09 +00:00
parent 30a3296c8e
commit 6647c40135
2 changed files with 25 additions and 1 deletions

View File

@ -175,6 +175,22 @@ class addressbook_hooks
'default'=> 'iso-8859-1', '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') if ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
{ {
$settings['private_addressbook'] = array( $settings['private_addressbook'] = array(

View File

@ -980,9 +980,17 @@ class addressbook_vcal extends addressbook_bo
{ {
return false; 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) foreach ($ids as $id)
{ {
fwrite($fp,$this->getVCard($id)); fwrite($fp,$this->getVCard($id, $charset));
} }
fclose($fp); fclose($fp);