Change text encoding
To show the file encoding of the current file on the editor toolbar (4) in the Edit mode, go to Preferences > Text Editor > Display > Display file encoding.
To change the text encoding, select it on the toolbar, and then select new encoding in the Text Encoding dialog:
To reload the file with the selected encoding, select Reload with Encoding.
To save the file with the new encoding, go to Save with Encoding.
Set default encoding
To define the default file encoding, select Preferences > Text Editor > Behavior, and then select a suitable option in Default encoding.
Qt requires UTF-8 encoded source files, and therefore the default encoding is set to UTF-8.
If you try to edit a file that is not UTF-8 encoded, you see the following error message: Error: Could not decode "filename" with "UTF-8"-encoding. Editing not possible.
To resolve the issue, use a file conversion tool to convert the file encoding to UTF-8. Otherwise, conversion of string constants to QString might not work as expected.
If you do not develop Qt applications, you can set other encoding options as the default encoding. Select the System option to use the file encoding used by your system.
See also How To: Edit Code, Edit Mode, and Behavior.
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.