PhpStorm 2021.1 Help

Code Inspection: Lossy encoding

This inspection warns you of characters that the current document encoding is incapable to represent.
For example, when you are

  • typing international characters in a document configured to US-ASCII charset. Some characters will be lost on save.

  • or loading UTF-8 -encoded file using ISO-8859-1 one-byte charset. Some characters will be displayed incorrectly.

You fix this by changing the file encoding, either by specifying the encoding directly in the file, e.g. by editing encoding= attribute in the XML prolog of XML file, or configuring the Settings|Project Settings|File Encodings.

Suppress an inspection in the editor

  1. Position the caret at the highlighted line and press Alt+Enter or click the Intention action icon.

  2. Click the arrow next to the inspection you want to suppress and select the necessary suppress action.

Last modified: 16 July 2021