Output encoding in copy with ant is not working


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output encoding in copy with ant is not working
# 1  
Old 03-19-2014
Output encoding in copy with ant is not working

Not sure whether I can post 'ant' related question here.
There is a requirement to convert files to UTF-8 format.

So, I tried this simple ant script.

Code:
<project name="try_copy" basedir="." default="copy_this">

        <target name="copy_this">
        <copy file="myfile.txt" tofile="mycopy.txt" encoding="ASCII" outputencoding="UTF-8" />
        </target>

</project>

But even after this, output encoding is not UTF-8 in output file.

What am I doing wrong?
# 2  
Old 03-19-2014
ASCII is a subset of UTF-8. All symbols that can be expressed in ASCII are encoded in the same way in UTF-8.
# 3  
Old 03-19-2014
Thanks for the reply. UTF-8 has 3 bytes header before actual data.

Code:
anandb ~ $ od -c file-in-UTF-8-format.txt
0000000 357 273 277   U   T   F   -   8       f   o   r   m   a   t
0000017

I gave normal file as input and was expecting same data but with header.

Last edited by Scott; 03-19-2014 at 08:51 AM.. Reason: Code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

View file encoding then change encoding.

Hi all!! I´m using command file -i myfile.xml to validate XML file encoding, but it is just saying regular file . I´m expecting / looking an output as UTF8 or ANSI / ASCII Is there command to display the files encoding? Thank you! (2 Replies)
Discussion started by: mrreds
2 Replies

2. Red Hat

Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-la

Have no idea on what the below error message is: Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-launcher.jar org.apache.tools.ant.launch.Launcher -buildfile build.xml dist. Any help? (3 Replies)
Discussion started by: gull05
3 Replies

3. Shell Programming and Scripting

Nifty (and non-working) File Copy Using ls

Greetings :) Got a basic one to muddle through tonight; and hoping for a smidgen of help 'long the way ;) Here 'tis:ls ./dir1/ | grep -i .jpg | xargs cp -f ./dir1/$1 ../../dir2/$1Simple enough; and to this amateur eye, it looks like things should work pretty well. But, of course, it tanks... (10 Replies)
Discussion started by: LinQ
10 Replies

4. Shell Programming and Scripting

Need help to check the copy % from following output

I have a scenario where I need to wait for the copy to be 100% in the following output There can be multiple devices in the copy session so I need to wait till everything becomes 100%, also we can look for the protected tracks t0 become 0 opey # symclone -sid 822 -v -f... (2 Replies)
Discussion started by: rajsan
2 Replies

5. Shell Programming and Scripting

How to find the file encoding and updating the file encoding?

Hi, I am beginner to Unix. My requirement is to validate the encoding used in the incoming file(csv,txt).If it is encoded with UTF-8 format,then the file should remain as such otherwise i need to chnage the encoding to UTF-8. Please advice me how to proceed on this. (7 Replies)
Discussion started by: cnraja
7 Replies

6. Windows & DOS: Issues & Discussions

ANT: Telnet is not working

I am trying the below ANT telnet task: <telnet userid="appldev" password="techm123" server="${BT_Server}"> <read>/u01/appldev/devappl/po/11.5.0/reports</read> <!--write>cd /u01/appldev/devappl/po/11.5.0/reports/</write--> <write>ls</write> <read... (0 Replies)
Discussion started by: Dip
0 Replies

7. UNIX for Advanced & Expert Users

Functionality of ant build and ant deploy unix commands

I have made some code changes in the corresponding java file for date formatting purpose so that it supports upgraded sybase version from 12.6 to 12.7 and have build the code and deployed using the following UNIX commands. ant build ant deploy. "ant build" executes the build.xml which is... (1 Reply)
Discussion started by: vmpcit
1 Replies

8. UNIX for Dummies Questions & Answers

Copy Command in Script Not Working

Hi, I have about enough UNIX knowledge to fill a thimble, but when a co-worker left I inherited an interface that runs Informatica on a UNIX box. I like UNIX, but my lack of skill is a real hindrance right now and I need to be able to archive the 9 csv files that are put in a directory by the FTP... (10 Replies)
Discussion started by: JeffR
10 Replies

9. UNIX for Dummies Questions & Answers

I want to copy the text output from a 'nohup.out' file.

Hello, I have a nohup.out file that, when executed, outputs a spreadsheet file with four-to-seven columns of number. I want to copy this output (in its entirety), so that I could then paste it on excel@ , or Notepad@. Please help, thanks. (3 Replies)
Discussion started by: Iamthe great
3 Replies
Login or Register to Ask a Question