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

Added charsetString variable #51

merged 2 commits into from
Mar 16, 2016

Conversation

Jako
Copy link
Contributor

@Jako Jako commented Oct 7, 2015

It seems to be the only option to generate vCards for Windows (I have done some tests with 7-10 and Outlook) with UTF-8 charset strings by adding ;CHARSET=utf-8 to each line that could contain utf-8 signs. It is not enough to set only the mime header, as it should be according to https://tools.ietf.org/html/rfc6350.

The charsetString variable is empty by default to stay valid with the RFC, but it could be set with setCharsetString to support Windows vCard import implementations.

@jeroendesloovere
Copy link
Owner

Hi @Jako , can you test if the latest release is a fix for your problem?

@Jako
Copy link
Contributor Author

Jako commented Nov 30, 2015

It could fix that maybe (haven't tested it yet). But in my opinion this fix has one big issue: You can only use chars that are in ISO-8859-1 in a vCard that way (http://php.net/manual/en/function.utf8-decode.php). And that charset is very limited: https://en.wikipedia.org/wiki/ISO/IEC_8859-1. A lot of eastern european signs are missing and all 'not latin' charsets are unsupported. It has to be written with UTF-8.

@jeroendesloovere
Copy link
Owner

Hi @Jako, thanks for your PR.
I'm sorry I get back so late to your PR.

Can you please test the latest release which added utf8_decoding in hope of fixing characters for Windows and Android.
af74013

@Jako
Copy link
Contributor Author

Jako commented Mar 16, 2016

As I said in my last comment, utf8_decode is somehow wrong, since the character set ISO-8859-1 is very limited. You can only handle western latin chars with that.

The output has to be UTF-8 encoded and (because of some import limitations in i.e. Outlook) all vCard fields that could contain UTF-8 signs should be marked with ;CHARSET=utf-8

@jeroendesloovere
Copy link
Owner

Thanks @Jako

* @param string $charset The charset for one property
* @return void
*/
public function setCharsetString($charset)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jako, please remove this function and integrate this code into ->getCharsetString(), since we already have our $this->charset; and ->setCharset($charset), your setCharsetString seems obsolete.

@jeroendesloovere
Copy link
Owner

Hi @Jako, if you can just adjust your PR a little. Then i'll merge it, so special characters work in Windows and Android.

- removed charsetString variable
@Jako
Copy link
Contributor Author

Jako commented Mar 16, 2016

Done. I have added a check for $this->charset == 'utf-8' inside, since I am not sure how other charsets have to be handled (if using a different internal charset). This way only a utf-8 charset changes the resulting vcf data.

jeroendesloovere added a commit that referenced this pull request Mar 16, 2016
Added charsetString variable
@jeroendesloovere jeroendesloovere merged commit 021b244 into jeroendesloovere:master Mar 16, 2016
jeroendesloovere added a commit that referenced this pull request Apr 18, 2016
Remove decoding utf8 for outlook, It fixed with pull request #51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants