1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-18 07:52:21 +01:00

Strip control chars after decoding from quoted printable.

This commit is contained in:
Thomas Tanghus 2012-09-03 17:11:03 +02:00
parent 3be10d04fb
commit e9315abed5

View File

@ -149,7 +149,14 @@ class OC_Contacts_VCard {
foreach($property->parameters as $key=>&$parameter){
if(strtoupper($parameter->name) == 'ENCODING') {
if(strtoupper($parameter->value) == 'QUOTED-PRINTABLE') { // what kind of other encodings could be used?
$property->value = quoted_printable_decode($property->value);
// Decode quoted-printable and strip any control chars
// except \n and \r
$property->value = preg_replace(
'/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/'
, ''
,
quoted_printable_decode($property->value)
);
unset($property->parameters[$key]);
}
} elseif(strtoupper($parameter->name) == 'CHARSET') {