-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #31958 - avoid messing up ENCODIGN & add CHARSET Workaround by limiting the too generic replacement for social networks. Add CHARSET for proper decoding.
- Loading branch information
Showing
1 changed file
with
5 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/* Copyright (C) Kai Blankenhorn <[email protected]> | ||
* Copyright (C) 2005-2017 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2020 Tobias Sekan <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -100,7 +101,7 @@ class vCard | |
/** | ||
* @var string encoding | ||
*/ | ||
public $encoding = "ENCODING=QUOTED-PRINTABLE"; | ||
public $encoding = "CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE"; | ||
|
||
|
||
/** | ||
|
@@ -163,7 +164,7 @@ public function setFormattedName($name) | |
public function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "") | ||
{ | ||
//$this->properties["N;".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); | ||
$this->properties["N"] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); | ||
$this->properties["N;".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); | ||
$this->filename = "$first%20$family.vcf"; | ||
if (empty($this->properties["FN"])) { | ||
$this->setFormattedName(trim("$prefix $first $additional $family $suffix")); | ||
|
@@ -211,7 +212,7 @@ public function setAddress($postoffice = "", $extended = "", $street = "", $city | |
$this->properties[$key] = encode($postoffice).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country); | ||
|
||
//if ($this->properties["LABEL;".$type.";".$this->encoding] == '') { | ||
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type); | ||
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type); | ||
//} | ||
} | ||
|
||
|
@@ -362,7 +363,7 @@ public function getVCard() | |
$text .= "VERSION:4.0\r\n"; // With V4, all encoding are UTF-8 | ||
//$text.= "VERSION:2.1\r\n"; | ||
foreach ($this->properties as $key => $value) { | ||
$newkey = preg_replace('/-.*$/', '', $key); // remove suffix -twitter, -facebook, ... | ||
$newkey = preg_replace('/(?<!QUOTED|UTF)-.*$/', '', $key); // remove suffix -twitter, -facebook, ... | ||
$text .= $newkey.":".$value."\r\n"; | ||
} | ||
$text .= "REV:".date("Ymd")."T".date("His")."Z\r\n"; | ||
|