DEV Community

KOGA Mitsuhiro
KOGA Mitsuhiro

Posted on • Originally published at qiita.com

IntelliJでプロパティのnative2ascii変換をEclipse互換にする

IntelliJとEclipseのnative2ascii変換の違い

IntelliJではSettingsFile EncodingsTransparent native-to-ascii conversionをオンにするとJavaのプロパティファイルを透過的にnative2ascii変換してくれます。

log.error=エラーが起きました
log.error=\u30A8\u30E9\u30FC\u304C\u8D77\u304D\u307E\u3057\u305F

ですが、Pleiades All in Oneに同梱されているProperties Editorを使うとIntelliJと違い小文字に変換されます。

log.error=\u30a8\u30e9\u30fc\u304c\u8d77\u304d\u307e\u3057\u305f

Eclipse使いが大半を占める中で一緒に開発していると、1文字変更しただけでも大文字小文字の違いでほとんどの値に差分が出てしまい、本当の差分が分かりにくくなります。

IntelliJでも小文字に変換する

IntelliJではnative2asciiの大文字小文字変換のようなニッチな設定も可能です。
ニッチ故に少し面倒ですがidea.propertiesに以下の値を追加します。

idea.native2ascii.lowercase=true

idea.propertiesの場所

WindowsとLinuxの場合はIntelliJをインストールしたフォルダの中にあります。

<IntelliJ IDEA installation folder>/bin/idea.properties

Macでも同じようにIntelliJをインストールしたフォルダの中にありますが、
~/Library/Preferences/IntelliJIdea12/idea.propertiesにコピーするとこちらが優先されます。
コピー先のフォルダはバージョン毎に異なるので、バージョンアップしたときは忘れないように再度コピーして設定してください。

~/Library/Preferences/IntelliJIdea12/idea.properties
/Applications/IntelliJ IDEA 12.app/bin/idea.properties

これでEclipse使いが多い開発でも安心です。

IntelliJ IDEA 2018.3 Help

以上の内容はIntelliJのヘルプを参考にしました。

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay