is there a way to remove BOM after creation of a file? here's the script that I create my file with <?php function writeUTF8File($filename,$content) { $f=fopen($filename,"w"); # Now UTF-8 - Add byte order mark fwrite($f, pack("CCC",0xef,0xbb,0xbf)); fwrite($f,$content); fclose($f); } ?> PHP: I found this function but I don't know how to use it: <?php function removeBOM($str=""){ if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) { $str=substr($str, 3); } return $str; } ?> PHP:
I have used the file and below were the file having BOM in them. These files had UTF8 BOM, but i cleaned them: administrator/components/com_virtuemart/tables/categories.php administrator/components/com_virtuemart/tables/products.php administrator/components/com_virtuemart/views/category/tmpl/edit_categoryform.php administrator/language/de-DE/de-DE.plg_vmcustom_specification.ini administrator/language/de-DE/de-DE.plg_vmpayment_heidelpay.ini administrator/language/en-GB/en-GB.com_jce.sys.ini administrator/language/en-GB/en-GB.mod_virtuemart_currencies.ini administrator/language/en-GB/en-GB.mod_virtuemart_manufacturer.ini administrator/language/en-GB/en-GB.mod_virtuemart_product.ini administrator/language/en-GB/en-GB.plg_vmcustom_specification.ini administrator/language/fr-FR/fr-FR.plg_vmcustom_specification.ini administrator/language/fr-FR/fr-FR.plg_vmpayment_moneybookers.ini administrator/manifests/files/TinyMCE_es-ES.xml administrator/manifests/packages/pkg_es-ES.xml components/com_virtuemart/assets/css/vmsite-ltr.css components/com_virtuemart/assets/js/languages/jquery.validationEngine-es.js components/new/com_virtuemart/assets/css/vmsite-ltr.css components/new/com_virtuemart/assets/js/languages/jquery.validationEngine-es.js installation-old/language/bn-BD/bn-BD.ini installation-old/language/lo-LA/lo-LA.ini installation-old/language/mk-MK/mk-MK.xml installation-old/language/ml-IN/ml-IN.ini installation-old/language/mn-MN/mn-MN.ini installation-old/language/sy-IQ/sy-IQ.ini installation-old/language/th-TH/th-TH.ini installation-old/language/ur-PK/ur-PK.ini installation-old/language/ur-PK/ur-PK.xml javascript/lang/calendar-br.js javascript/lang/calendar-el.js javascript/lang/calendar-fi.js javascript/lang/calendar-pl-utf8.js language/en-GB/en-GB.com_virtuemart-org.ini language/en-GB/en-GB.com_virtuemart.ini language/fr-FR/fr-FR.mod_virtuemart_category.sys.ini modules/mod_virtuemart_product/mod_virtuemart_product.php
Do you mean from the file after you've written it? writeUTF8File is adding the BOM so if that's where you want to "remove" it, just don't add it. Just comment out that line (or delete it). [COLOR="#008000"]//fwrite($f, pack("CCC",0xef,0xbb,0xbf));[/COLOR] Code (markup):