Title: vCard with utf8 BOM
Last modified: August 7, 2019

---

# vCard with utf8 BOM

 *  Resolved [frachtcontor](https://wordpress.org/support/users/frachtcontor/)
 * (@frachtcontor)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/vcard-4/)
 * Hello,
 * thanks for your great tool.
 * We got one problem with the vcf Vcard files.
 * Since we upgraded your plugin (9.1.1) and php (to 7.3 fpm) the vcards are generatet
   in Utf8 with BOM.
    This destroys the vCard’s. When you open the file and save
   it to UTF8 without BOM everything is ok.
 * Our Database is on utf8mb4 and wp-config utf8mb4.
    Can you help us with this?
 * Tanks and Best regards
    -  This topic was modified 6 years, 10 months ago by [frachtcontor](https://wordpress.org/support/users/frachtcontor/).

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Steven](https://wordpress.org/support/users/shazahm1hotmailcom/)
 * (@shazahm1hotmailcom)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/vcard-4/#post-11809359)
 * hmmm… odd… I think that the BOM might be applied by the web host as Connections
   does not add BOM to vCards.
 * I dev and test using PHP 7.3.7 so I do not think this is related to the PHP version.
   And BOM is applied to the beginning of the file contents. The only place BOM 
   is added in Connections is the CSV Export tools. I only added it because Excel
   can be dumb and not recognize a UTF8 encoded file properly if BOM is not applied.
 * Can you share a link to your directory page so I can download a vCard from you
   site so I can inspect it?
 *  Thread Starter [frachtcontor](https://wordpress.org/support/users/frachtcontor/)
 * (@frachtcontor)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/vcard-4/#post-11809386)
 * Thanks for your fast Help! 🙂
 * Sure:
    [https://www.frachtcontor.com/en/contact/contact-directory/](https://www.frachtcontor.com/en/contact/contact-directory/)
 * click on “Add to Address Book.” to download the vCard.
 * Best regards
 *  Plugin Author [Steven](https://wordpress.org/support/users/shazahm1hotmailcom/)
 * (@shazahm1hotmailcom)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/vcard-4/#post-11809655)
 * Well, BOM is definitely being applied, not that I did not believe you, I did.
 * Looking thru the code this in not being applied by Connections.
 * Perhaps trying a plugin conflict check… deactivate all other plugins temporarily
   to see if the issue still persists.
 *  Thread Starter [frachtcontor](https://wordpress.org/support/users/frachtcontor/)
 * (@frachtcontor)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/vcard-4/#post-11811505)
 * Hm, I tested it. No luck.
    Updated again php – No luck. php.inis are all set 
   to `default_charset = "UTF-8"` Is there something wrong with this Template? “
   Default Entry Card 3.0 by Steven A. Zahm”
 * In which function the vCard and the link are generated?
 *  Thread Starter [frachtcontor](https://wordpress.org/support/users/frachtcontor/)
 * (@frachtcontor)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/vcard-4/#post-11811716)
 * Another thing is when I try to disable or enable it under entry action nothing
   happens.
    The vCard link is always visible.
 * ??
 *  Plugin Author [Steven](https://wordpress.org/support/users/shazahm1hotmailcom/)
 * (@shazahm1hotmailcom)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/vcard-4/#post-11812829)
 * **RE: Is there something wrong with this Template?**
 * The template has no function and is not involved in any way with generating and
   downloading a vCard.
 * **RE: Another thing is when I try to disable or enable it under entry action 
   nothing happens. The vCard link is always visible.**
 * This is because the template has been altered. In the “stock” template (as supplied)
   the vCard link does not exist within the template. It exists as a link above 
   the entry which is only visible when view the single entry profile/detail page
   which seems to have disabled or removed.
 * Here’s a directly link on your site to the single entry profile/detail page:
 * [https://www.frachtcontor.com/en/contact/contact-directory/name/agnieszka-andrzejewska/](https://www.frachtcontor.com/en/contact/contact-directory/name/agnieszka-andrzejewska/)
 * Here you will see the “Add to Addressbook” action link. That settings controls
   whether or not that link is visiable.
 * **RE: In which function the vCard and the link are generated?**
 * The vCard is generated and downloaded n this function:
 * [https://github.com/Connections-Business-Directory/Connections/blob/9.1.1/includes/entry/class.entry-vcard.php#L521-L584](https://github.com/Connections-Business-Directory/Connections/blob/9.1.1/includes/entry/class.entry-vcard.php#L521-L584)
 * If Connections were adding BOM it would have this code `echo "\xEF\xBB\xBF";`
   before the `echo $data;` code in the function. Which, as you see, it does not.
 * At this point, I suspect the web host is adding the BOM somehow. It may be worth
   reaching out to their support team. Unfortunately you’ll probably have to get
   it bumped up a few support levels because I highly doubt the lowers level support
   team members will understand the issue. At least that is just my experience with
   tech support when it comes to the more technical issues like these.
 * After doing a quick web search, I found this:
 * [https://stackoverflow.com/questions/6328750/how-do-i-fix-this-php-download-script-which-is-corrupting-files](https://stackoverflow.com/questions/6328750/how-do-i-fix-this-php-download-script-which-is-corrupting-files)
 * It seems PHP might add BOM automatically to the header if the PHP file themselves
   are saved as UTF8 with BOM. Now, the Connections files are UTF8 but do not have
   BOM. It is possible when WP installs the Connections, during the unzipping process,
   that PHP on your server is adding BOM to the files. I would suggest opening one
   of the plugin files to see if the BOM does exist. If it does, then this might
   be the cause of the issue. If it is, you would still have to work with your web
   host to figure out why BOM is being applied to the files when WP installs them.
 * I hope this helps, let me know what you learn.
 *  Thread Starter [frachtcontor](https://wordpress.org/support/users/frachtcontor/)
 * (@frachtcontor)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/vcard-4/#post-11815797)
 * Thanks for your long post.
 * I run out of ideas.
    It’s easy to find all files with BOM: `grep -rlI $'\xEF\
   xBB\xBF' .` But there is nothing in php….
 * The webserver is ok. On other places on the site it works well.
    It delivers 
   evrything with UTF-8. Copied the hole vcard class but brings nothing. The log
   shows me
 * `GET /index.php?id=XX&type=XX&tx_wtdirectory_pi1[vCard]=XXX&cHash=XXXXXXXXXXXXXXXXXXXXXXXX`
 * I dunno 🙁
 *  Plugin Author [Steven](https://wordpress.org/support/users/shazahm1hotmailcom/)
 * (@shazahm1hotmailcom)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/vcard-4/#post-11816862)
 * Sorry, I can not think of a single reason why BOM is being applied to vCards.
   As you see, it is not being applied or added by Connections so I am at a loss
   as to why and how it is being applied.
 * Sorry I can not figure this out for you!
 * I guess one thing you could try… in the vCard class in Connections, try manually
   stripping BOM from `$data` before it is echo using this function:
 * [https://stackoverflow.com/a/15423899/5351316](https://stackoverflow.com/a/15423899/5351316)
 * Run `$data` thru the function and then echo it.
 * If you still get BOM in the vCard then it is the echo that is adding it which
   means it is PHP adding for some reason.
 * If that is the case, before you echo `$data` start an output buffer using `ob_start()`,
   then echo, and then use `ob_get_clean()` and run that thru the BOM removing function
   and then echo it again. It’s a bit Rube Goldberg but if PHP is adding it, this*
   should* remove it.
 * I hope that helps, please let me know what your learn.
 *  Plugin Author [Steven](https://wordpress.org/support/users/shazahm1hotmailcom/)
 * (@shazahm1hotmailcom)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/vcard-4/#post-11853190)
 * [@frachtcontor](https://wordpress.org/support/users/frachtcontor/)
 * Just curious if you had the opportunity to track the hack/work around I suggested
   in my last reply?
 *  Thread Starter [frachtcontor](https://wordpress.org/support/users/frachtcontor/)
 * (@frachtcontor)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/vcard-4/#post-12137375)
 * Hey sorry for the late response. I dont find it out. Just disabled it rebuild
   the page and test it local, there it worked.
    -  This reply was modified 6 years, 6 months ago by [frachtcontor](https://wordpress.org/support/users/frachtcontor/).

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘vCard with utf8 BOM’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/connections_2b7e99.svg)
 * [Connections Business Directory](https://wordpress.org/plugins/connections/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/connections/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/connections/)
 * [Active Topics](https://wordpress.org/support/plugin/connections/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/connections/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/connections/reviews/)

## Tags

 * [BOM](https://wordpress.org/support/topic-tag/bom/)
 * [vcard](https://wordpress.org/support/topic-tag/vcard/)

 * 10 replies
 * 1 participant
 * Last reply from: [frachtcontor](https://wordpress.org/support/users/frachtcontor/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/vcard-4/#post-12137375)
 * Status: resolved