[x3d-public] Ant build file settings for encoding UTF-8

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Fri Jun 14 04:45:08 PDT 2019


While integrating your improvement, I found a bug and a mismatch in build.xml for Ant.

Current build.xml javac invocations use encoding="utf8".  Note the encoding attribute is how Ant recommends setting this value.

	Ant javac
	https://ant.apache.org/manual/Tasks/javac.html

Meanwhile found Java documentation that gives UTF-8 as spelling, matching your approach.

===========================
Oracle Java Documentation

Java Platform, Standard Edition Tools Reference: javac
https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html

-encoding encoding
     Set the source file encoding name, such as EUC-JP and UTF-8. If -encoding is not specified, the platform default converter is used.
===========================

Am thinking that it is likely preferred to use Ant approach, especially since multiple versions of Java are currently active.

I added the encoding attribute to other javac tasks that were missing it.

Fixed build.xml in this manner.  Current version at

	https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/build.xml

Hoping you can test that?  Otherwise we can fall back to your workaround:

     <!-- added the following line by AONO 2019,May 22-->
     <property name="fileUTF8" value="-encoding UTF-8"/>

     <compilerarg line="${fileUTF8}" />

Next, I see that you also added a similar construct to a number of <java> invocations.  However there are 116 of these in the build!  It also has different syntax compared to the property... Is such an entry also needed for java execution?  Or perhaps a global property setting is possible?

             <arg value ="-Dencoding=UTF-8"/>

Thanks for checking these points, since they aren't really confirmable (except for absence of warnings) on my system.

On 6/12/2019 9:59 PM, Masaki Aono wrote:
> Dear Dr. Don Brutzman,
> 
> Greetings.
> 
> Attached please find "build.xml" I used in doing
> 
>  > ant create.X3DJSAIL
> 
> I inserted a comment with my name "AONO" near the lines I edited.
> 
> Sincerely,
> 
> On 2019/06/13 11:08, Brutzman, Donald (Don) (CIV) wrote:
>> Thanks Masaki, very helpful.
>>
>> Yes we require UTF-8 support as default in all X3D models, regardless of file format or programming language.
>>
>> If you can send me (or simply attach in email) your modified build.xml I can incorporate the necessary UTF-8 additions.
>>
>> Domo arigato!  どうもありがとう
>>
>> p.s. Japan is not yet represented here:
>>
>> http://x3dgraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes/
>>
>> On 5/21/2019 6:19 PM, Masaki Aono wrote:
>>> Dear John and all,
>>>
>>> Before going into "go to pyjinus", I would like to report the following:
>>>
>>> Basically, I succeeded in the first stage ant (i.e. ant create.X3DJSAIL).
>>>
>>> However, I had to modify "build.xml" a lot.
>>>
>>> This is because Java's native compiler (javac) is notorious in that
>>>
>>> it expects native locale (here Windows encoding is MS932 (or SHIFT_JIS)) instead of UTF-8.
>>>
>>> https://stackoverflow.com/questions/9661935/how-to-change-the-defaults-system-java-encode-form-in-windows
>>>
>>> Thus, I had to insert the following inside build.xml:
>>>
>>> (1)      <property name="fileUTF8" value="-encoding UTF-8"/>
>>> Somewhere in the beginning
>>>
>>> (2)      <compilerarg line="${fileUTF8}" />
>>> Everywhere inside <javac> tasks.
>>>
>>> BTW, for execution under Windows
>>>
>>> $ java -Dencoding=utf-8 ....
>>>
>>> is needed.
>>>
>>> The above modification is valid only for Windows.
>>>
>>> For Ubuntsu (Linux) and MAC, things are different. For compilation,
>>>
>>> $ javac -J-Dfile.encoding  xxx.java
>>>
>>> while for execution,
>>>
>>> $ java -Dencoding=utf-8 xxx
>>>
>>> This means build.xml has to adapt to different OS environments, I think.
>>>
>>> I believe these nasty things may not be obvious for ASCII locale people.
>>>
>>> No offense intended.
>>>
>>> Sincerely,
>>>
>>> On 2019/05/21 15:03, John Carlson wrote:
>>>> Dr Aono,
>>>>
>>>> I had to do a single svn cleanup & svn up from the www.web3d.org <http://www.web3d.org> folder.  Now I will build.
>>>>
>>>> (assuming you are in www.web3d.org <http://www.web3d.org> folder)
>>>>
>>>> cd x3d/stylesheets
>>>>
>>>> ant create.X3DJSAIL
>>>>
>>> -- 
>>> ******************************************************
>>> 青野雅樹
>>> 豊橋技術科学大学 情報・知能工学系
>>> 知識データ工学・情報検索研究室
>>> 〒441-8580 豊橋市天伯町雲雀ヶ丘1-1
>>> TEL:(0532)  44-6764
>>> FAX:(0532) 44-6757
>>>
>>> Masaki Aono
>>> Professor
>>> Knowledge Data Engineering Laboratory
>>> Dept. of Computer Science and Engineering
>>> Toyohashi University of Technology
>>> 1-1 Hibarigaoka, Tempaku-cho,
>>> Toyohashi-shi, Aichi 441-8580 JAPAN
>>> TEL: 81+532-44-6764
>>> FAX:81+532-44-6757
>>> email:aono at tut.jp
>>> ******************************************************
>>>
>>
>> all the best, Don
> 


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman


More information about the x3d-public mailing list