ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shashidhar Kotta" <Shashidhar.Ko...@ness.com>
Subject RE: Passing multi-byte strings from ANT using <sysproperty> task
Date Thu, 11 Dec 2008 10:27:39 GMT

Hi,

I have tried with your ANT code but it is displaying ?m?n??? only.

Here is the simple java code which I am using.

		OutputStreamWriter bos = new OutputStreamWriter(new FileOutputStream("D://testoutput.txt"),"UTF-8");
		String username = System.getProperty("com.param1").trim();		
		bos.write(username);
		bos.close();

and here is the output from "testoutput.txt" file  -?m?nя??


Thanks,
Shashidhar Kotta.

-----Original Message-----
From: Greg Roodt [mailto:groodt@gmail.com] 
Sent: Thursday, December 11, 2008 3:42 PM
To: Ant Users List
Subject: Re: Passing multi-byte strings from ANT using <sysproperty> task

Ok, could you send me a simplified version of your Java code that is writing
the data to a file?
Does this work correctly for you?

<?xml version="1.0" encoding="UTF-8"?>
<project name="encoding-test" basedir="." default="echo">
<property name="com.param1" value="ђmỘnяỘỆ" />
 <target name="echo">
<echo message="${com.param1}" />
</target>
</project>





On Thu, Dec 11, 2008 at 9:49 AM, Shashidhar Kotta <Shashidhar.Kotta@ness.com
> wrote:

>
> Hi,
>
> You mean Unicode escapes sequences like '\u0012'?
>
> We have tried by passing the Unicode escape sequence like
> > "<sysproperty key="com.param1" value="\u0012" />"
>
> But when we call System.getProperty("com.param1") it is just giving us the
> same escapes sequences like '\u0012'.
>
> Surprisingly if we set this inside the java program(like the code below)
> then it is printing proper multi-byte character:
>
>                System.setProperty("com.param1", "\u0012");
>                System.out.println(System.getProperty("com.param1"));
>
> Thanks,
> Shashidhar Kotta.
>
> -----Original Message-----
> From: Greg Roodt [mailto:groodt@gmail.com]
> Sent: Thursday, December 11, 2008 2:03 PM
> To: Ant Users List
> Subject: Re: Passing multi-byte strings from ANT using <sysproperty> task
>
> This is a guess, but try using the Unicode escape sequences for your
> sysproperty.
>
>
>
> On Thu, Dec 11, 2008 at 7:12 AM, Shashidhar Kotta <
> Shashidhar.Kotta@ness.com
> > wrote:
>
> >
> > Hi All,
> >
> >
> >
> > In our project we have requirement to pass multi-byte strings from ANT to
> > java program. We are passing multi-byte strings using the <sysproperty>
> ANT
> > task. In the java program we are retrieving it using the
> > System.getProperty() method and saving that value to a text file which is
> in
> > UTF-8 format. But the proper multi-byte string is not getting saved into
> the
> > file. Could someone help me in resolving this issue?
> >
> >
> >
> > In the ANT file we are passing the multi-byte string like this:
> > "<sysproperty key="com.param1" value="ђmỘnяỘỆ" />"
> >
> > In the java program we are retrieving the string like
> > "System.getProperty("com.param1")".
> >
> >
> >
> > We are working on Windows environment with language pack installed and
> > using the Eclipse which has "text file encoding" property set to UTF-8.
> > Could someone help me in resolving this issue?
> >
> > Thanks in Advance…
> >
> >
> >
> >
> >
> > Thanks,
> >
> > Shashidhar Kotta.
> >
> >
> >
> >
> > Disclaimer
> >
> > The information contained in this communication is intended solely for
> the
> > use of the individual or entity to whom it is addressed and others
> > authorized to receive it.   It may contain confidential or legally
> > privileged information.   If you are not the intended recipient you are
> > hereby notified that any disclosure, copying, distribution or taking any
> > action in reliance on the contents of this information is strictly
> > prohibited and may be unlawful. If you have received this communication
> in
> > error, please notify us immediately by forwarding this email to
> > MailAdmin@ness.com and then delete it from your system. Ness
> technologies
> > is neither liable for the proper and complete transmission of the
> > information contained in this communication nor for any delay in its
> > receipt.
> >
>
> Disclaimer
>
> The information contained in this communication is intended solely for the
> use of the individual or entity to whom it is addressed and others
> authorized to receive it.   It may contain confidential or legally
> privileged information.   If you are not the intended recipient you are
> hereby notified that any disclosure, copying, distribution or taking any
> action in reliance on the contents of this information is strictly
> prohibited and may be unlawful. If you have received this communication in
> error, please notify us immediately by forwarding this email to
> MailAdmin@ness.com and then delete it from your system. Ness technologies
> is neither liable for the proper and complete transmission of the
> information contained in this communication nor for any delay in its
> receipt.
>

Disclaimer

The information contained in this communication is intended solely for the use of the individual
or entity to whom it is addressed and others authorized to receive it.   It may contain confidential
or legally privileged information.   If you are not the intended recipient you are hereby
notified that any disclosure, copying, distribution or taking any action in reliance on the
contents of this information is strictly prohibited and may be unlawful. If you have received
this communication in error, please notify us immediately by forwarding this email to MailAdmin@ness.com
and then delete it from your system. Ness technologies is neither liable for the proper and
complete transmission of the information contained in this communication nor for any delay
in its receipt.
Mime
View raw message