About File Encodings
See Also
When creating a file for a project, the files are created using the specified
project encoding. Some file types
declare the encoding in the file, e.g. HTML, JSP, and XML files. Therefore,
when the IDE creates these files, it automatically includes character encoding
declarations in the file template.
When determining the character encoding for a file, the IDE applies the
FileEncodingQuery (FEQ) layer model. It first determines whether the encoding
is declared in the file. If no encoding declaration can be found, the IDE
presumes the file encoding is specified by the project's encoding property.
If the project encoding is not specified (e.g. imported or older projects),
the IDE applies the encoding set by the environment in which it runs.
Setting Character Encoding for Files
To change the encoding for a file (e.g. HTMl, XML, or JSP files) you need
to change the encoding and charset specified in the corresponding tag in
the file. When an encoding is specified in a file, this setting overrides
the encoding set in the project.
To manually change the character encoding for a file:
- Open the file in the Source editor.
- Modify the encoding and charset tags for the file, if available.
- The IDE does not convert characters when the encoding of a file changes.
If you manually change the encoding declaration within the file, and that
encoding does not match the project encoding, you may encounter problems when
compiling and running the project. This is due to the fact that the encoding tag
affects how file contents are viewed internally - not only during runtime,
but also during the design phase (i.e. adding content in the Source Editor).
- Manually changing the character encoding declaration within a file changes
how the IDE reads and displays that file. When you change the file encoding,
the IDE does not convert the existing contents of the file to the new encoding.
Care should be taken when changing the encoding of a file because the file
may contain characters that cannot be saved or that may not display properly
in the new encoding.
- See Also
- About Project Encodings
Legal Notices