このページでは

テキストのエンコーディングを変更

編集モードのツールバー

Edit モードで、エディタのツールバー(4)に現在のファイルのエンコーディングを表示するには、[Preferences ] > [Text Editor ] > [Display ] > [Display file encoding] の順に選択します。

テキストエディタの設定にある「表示」タブ

テキストのエンコーディングを変更するには、ツールバーでエンコーディングを選択し、[Text Encoding ] ダイアログで新しいエンコーディングを選択します。

「テキストエンコーディング」ダイアログ

選択したエンコーディングでファイルを再読み込みするには、「Reload with Encoding 」を選択します。

新しいエンコーディングでファイルを保存するには、「Save with Encoding 」を選択します。

デフォルトのエンコーディングを設定する

デフォルトのファイルエンコーディングを定義するには、[Preferences ] > [Text Editor ] > [Behavior] の順に選択し、[Default encoding] で適切なオプションを選択します。

テキストエディタの設定にある「Behavior」タブでのファイルエンコーディング

Qt XML では UTF-8 エンコードされたソースファイルが必要であるため、デフォルトのエンコーディングは「UTF-8 」に設定されています。

UTF-8 エンコーディングではないファイルを編集しようとすると、次のエラーメッセージが表示されます。Error: Could not decode "filename" with "UTF-8"-encoding. Editing not possible.

この問題を解決するには、ファイル変換ツールを使用して、ファイルのエンコーディングを UTF-8 に変換してください。そうしないと、文字列定数のQString への変換が期待通りに機能しない可能性があります。

Qt XML アプリケーションを開発していない場合は、他のエンコーディングオプションをデフォルトのエンコーディングとして設定できます。「System 」オプションを選択すると、システムで使用されているファイルエンコーディングが使用されます。

「手順: コードの編集」、「コードの編集」、および「動作も参照してください

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.