Remove BOM from file - how ?
I downloaded file index.php from server. This file is incorect saved with BOM (not by me but by other person).
Now PHP generate something like this:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /index.php:1) in /inc/config.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /index.php:1) in /inc/config.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at /index.php:1) in /inc/config.php on line 12
Question.
How can I remove BOM from this file via PHPStorm ?
Please sign in to leave a comment.
Hi Daniel,
There is no special action in PhpStorm to Add/Remove BOM signature. But there is one way how this can be achieved it without leaving PhpStorm and not using any 3rd party program (like Notepad++, for example). This is not very practical (in my opinion), but works :).
The trick is:
1) create new empty file (for example: temp123.php)
2) make sure that code-page/encoding for that file is UTF-8
3) copy whole content from original to newly created file (select all, copy, go to another tab, paste) and save
4) delete original file and rename new file -- give it the name of the original file.
Exactly what I was looking for. Thanks Andriy :)
Are you sure? :)
"File | Remove BOM" action is available for like 2 years now...
:^O That would have saved me a couple of hours had i known about it yesterday.
I see that you can ctrl+a all the files in the Projects pane and then alt+f -> 'Remove BOM' too to batch remove all boms from all files.
Very cool!
Thanks for the update. :)
@Andriy Bazanov Thanks man! :-D
Latest version has this option in File -> File Properties -> Remove BOM