I'm attempting to create vcards for a user with a name like "O'Reilly". The apostrophe is getting HTML encoded in the vcard. In testing support for other characters, I changed one character to use an accent character and the vcard view stopped working completely. "Set a last name to Dooleý".

In the special character situation, there were no logs in the drupal log. It just didn't display anything in the preview.

I haven't yet had a chance to dig into the code so just reporting for now.

CommentFileSizeAuthor
#5 output_has_html-2822759-5.patch3.69 KBneograph734

Comments

ratatine created an issue. See original summary.

ratatine’s picture

The encoding issue is due to function template_preprocess_views_vcards_view_row_vcard is views/theme/theme.inc. It's calling check_plain() on all the variables being passed.

Still not sure about the special characters.

neograph734’s picture

Strange, I thought this had been fixed with #2720353: Umlauts are not displayed correctly in vcard. If you have time, feel free to look around. I'll have a look at it when I can as well but that would be somewhere next week.

neograph734’s picture

The issue appears to be coming from the utf8_decode's and the check_plain's in template_preprocess_views_vcards_view_row_vcard() in views_vcards/views/theme/theme.inc.

Once I remove those, the examples given above work as expected...
But that is not a solution, as every user can alter the values of the fields as he desires leading to potentially dangerous situations, so the text needs to be sanitized before output.

I'll try to find another way to make sure the text is save.

neograph734’s picture

Status: Active » Needs review
StatusFileSize
new3.69 KB

Please try attached patch, which uses filter_xss rather than utf8_decode and check_plain.

neograph734’s picture

neograph734’s picture

@ratatine can you confirm the attached patch works for you?

  • Neograph734 committed 643db91 on 7.x-1.x
    Issue #2822759 by Neograph734: Output has HTML entities encoded plus...
neograph734’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

khalimero’s picture

Version: 7.x-1.3 » 8.x-2.0

Hi all,

I am facing with the same kind of problem on the last 8.x-2.0 version of the module.

The accented and apostrophe characters are not ouput correctly (the first ones seems to be encoded with the wrong charset, the second ones are raw html '), neither in the preview nor in the vcf/zip export.

I have very basic knowledge in programming, so I took a look into the views_vcards.module file, and tried to remove the utf8_decode from the few last lines.

It solved the accented characters problems, but not the apostrophe, still displayed as raw html.

Do you have any advice to solve the problem. If it helps, I precise the server is a Linux Debian server, and I am working from a Windows 10 laptop client, French version...

Regards,

Remi.

neograph734’s picture

Status: Closed (fixed) » Needs work

Hi Remi,

That is unfortunate. I did run some tests so I am not really sure why this is still occuring. To be sure, the letters you mention are just regular accented letters like é,à,ó, etc and an apostrophe ' right? So I can validate and test the problem.

' is a different case, that is encoded twice; & writes as an ampersand character (&), so it should be ', which in turn is HTML encoded apostrophe character ('). Perhaps the text is encoded twice, rather than encoded and decoded.

I am a bit busy at the moment, so I hope I'll a moment to look into this in the short term. Thanks for making me aware of the issue!

neograph734’s picture

Remi, could you please try the development version of the module and see if the problem is solved for you?

There still appears to be an issue with Windows and Outlook not properly displaying accented characters (ý displays as ý), but that appears an issue of Windows being incapable of handling UTF-8 vcards (the ý is correct in the vcard file). I hope to be able to find a workaround for this as well.

neograph734’s picture

Version: 8.x-2.0 » 8.x-2.x-dev
Status: Needs work » Needs review
neograph734’s picture

Status: Needs review » Fixed

I believe this has been fixed and the output is correct now. There is a known issue for Windows Contacts for which I have no solution at the moment: #2866862: Windows contacts incorrectly displays special characters.

ratatine’s picture

Just a quick reply in apologies for not responding 5 months ago. Drupal.org must not be setup to notify me when new replies come in as I'm only logging in and seeing this now. Thanks for commiting the fix!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.