Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added charsetString variable #51

Merged
merged 2 commits into from
Mar 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions src/VCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function addAddress(
// set property
$this->setProperty(
'address',
'ADR' . (($type != '') ? ';' . $type : ''),
'ADR' . (($type != '') ? ';' . $type : '') . $this->getCharsetString(),
$value
);

Expand Down Expand Up @@ -123,7 +123,7 @@ public function addCompany($company)
{
$this->setProperty(
'company',
'ORG',
'ORG' . $this->getCharsetString(),
$company
);

Expand Down Expand Up @@ -165,7 +165,7 @@ public function addJobtitle($jobtitle)
{
$this->setProperty(
'jobtitle',
'TITLE',
'TITLE' . $this->getCharsetString(),
$jobtitle
);

Expand Down Expand Up @@ -246,7 +246,7 @@ public function addName(
$property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
$this->setProperty(
'name',
'N',
'N' . $this->getCharsetString(),
$property
);

Expand All @@ -255,7 +255,7 @@ public function addName(
// set property
$this->setProperty(
'fullname',
'FN',
'FN' . $this->getCharsetString(),
trim(implode(' ', $values))
);
}
Expand All @@ -273,7 +273,7 @@ public function addNote($note)
{
$this->setProperty(
'note',
'NOTE',
'NOTE' . $this->getCharsetString(),
$note
);

Expand Down Expand Up @@ -487,6 +487,20 @@ public function getCharset()
return $this->charset;
}

/**
* Get charset string
*
* @return string
*/
public function getCharsetString()
{
$charsetString = '';
if ($this->charset == 'utf-8') {
$charsetString = ';CHARSET=' . $this->charset;
}
return $charsetString;
}

/**
* Get content type
*
Expand Down