B
B
Billy Milligan2013-11-26 00:45:46
PHP
Billy Milligan, 2013-11-26 00:45:46

How to force PhpStorm 7.0 to save documents in UTF-8 without BOM?

Hello everyone, I encountered an anomaly, well, or my hands are crooked ...

<?php
session_start();
?>

Causes an error, at first I did not understand, since all other files with the session work without error.
Well, of course, I checked if there are spaces before <?php and the like. I took notepad++ and changed the encoding to UTF-8 without BOM, well, everything works, but when I save the file after changes in PhpStorm, it saves it with BOM.
1) It’s not clear why only this file has such an error, but not the rest. (I copied a normally working file, pasted the code into it and it worked fine until the first ctrl + s)
2) I didn’t find UTF-8 without BOM in the storm, I I take it it's not there?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Anatol Pohorilyi, 2013-11-26
@Billy_Milligan

In addition @nazarpc
In order not to strain too much with Notepad ++
PS The hotkey is assigned by me, by default it is not

N
Nazar Mokrinsky, 2013-11-26
@nazarpc

The File menu has a Remove BOM command

X
Xenkok, 2013-11-26
@Xenkok

In order to know for sure whether the problem is in the BOM, open your file in a HEX editor and look at the first 3 characters. If they are EF BB BF then yes, your file is saved with BOM.

S
Sergey, 2013-11-26
Protko @Fesor

1) do other files have ?> at the end? I doubt that this is the reason, but still ... Yes, and it's just bad practice.
2) by default storm should create files without bom. All in all, it's configurable. I remember in the 5th version if you open a file in utf8 with bom, then there was a button that allows you to remove this matter.
generally strange, they usually complain that the storm, on the contrary, removes the bom.

A
Ant0ha, 2014-08-18
@Ant0ha

It is recommended in php conventions not to specify a closing php tag if it is at the end of a file. So that there are no such problems.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question