UTF-8 encoding in ADF applications

761 views
Skip to first unread message

Torsten Kleiber

unread,
Apr 17, 2014, 3:21:07 AM4/17/14
to adf-met...@googlegroups.com
Hi!
 
After some Problems with german umlauts in the ui and in tests we try to convert encoding of our existing files form cp1252 to UTF-8 as supposed in ADF Achitecture TV.
 
We have checked the following with JDeveloper 11.1.1.5.0 and 12.1.2.0.0 on windows 7.
 
Now the first questions come up:
 
  1. Unfortunatly the encoding is by default initialized to cp1252 on german windows 7 JDeveloper installations. Should this be changed in future versions? Is there a way to export / import such properties at intall time to set this for all developers to the same (same configuration for all developers is supposed in another episode of ADF Achitecture TV an by Jez Humble "Continous Delivery").
  2. How to automatically check that no file in the future comes into the codebase with other encoding? Are anybody know a checker tool which can be used in the CI build process?
  3. Despite setting the preferences for environment in JDeveloper to UTF-8 the file encoding of new jws, jpr, java-files seems to be ANSI until I add some german umlauts to the file somewhere. I don't know if the file encoding is really ANSI, or the tools cannot check the UTF-8 encoding before there german umlauts exist. Actually I check the encoding via opening the file in notepad, press "file - save as" and look at the "encoding" there. Are there better ways to do this?
  4. Any tips to further documentation / community related to this ?
Kind regards
Torsten Kleiber

Wilfred van der Deijl

unread,
Apr 18, 2014, 4:15:49 AM4/18/14
to adf-met...@googlegroups.com
I also don't understand why the default char encoding in JDev is platform dependent. For example on my Mac it is "MacRoman" which might confuse international Windows users :-) I always set JDev to use UTF-8 as default encoding, but it is really something everyone in your team has to do and preferably before starting a project so all files are created in UTF-8

But this got me thinking and I created a Jira issue for the ADF EMG Audit project: https://java.net/jira/browse/ADFEMG_AUDITRULES-26
This new audit rule could check that each XML file is in the UTF-8 encoding and suggest to the user in the audit warning to set UTF-8 as default in JDev's preferences. Anyone is invited to implement this AUDITRULES-26 issue,. It is an open source community project for a reason :-)

Non-XML files (like java source) are impossible to check, unless you introduce byte-order-markers but many tools will fail of a BOM is present. Hopefully suggesting the proper default through an audit rules does the trick.
BTW my suggestion is to only use plain ASCII in Java files. Better use \u1234 so you know everybody can read the java file regardless the character encoding they use when opening the file.
Reply all
Reply to author
Forward
0 new messages