You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Shashidhar Kotta <Sh...@ness.com> on 2008/12/11 08:12:03 UTC

Passing multi-byte strings from ANT using task

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.

Re: Passing multi-byte strings from ANT using task

Posted by Greg Roodt <gr...@gmail.com>.
Mark,
Basically SK wants to pass a System Property into a Java programme executed
by Ant. The problem is, that he wants to set non-ASCII characters as the
System Property, which is a bit tricky.

I agree with you, we need a clearer understanding of what SK is trying to
achieve and perhaps BASE-64 or escape codes will be sufficient.

Greg


On Thu, Dec 11, 2008 at 11:12 AM, Mark Salter <ma...@talktalk.net>wrote:

> Shashidhar Kotta wrote:
> > Hi,
> >
> > I have tried with your ANT code but it is displaying ?m?n??? only.
>
> Your code is encoding the String it sees into UTF-8, this is likely the
> right output, but not what you expected?
>
> You need to think through what you are trying to do, but from this
> result, I would suggest that your code might be receiving the Unicode
> value correctly from Ant.  I would be surprised though.  To check you
> would need to print the string in a Unicode 'aware' way.
>
> To guide, we need to know what you intend to do with this string, but
> this is less of an Ant question and more a Java question.
>
> >
> > 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я??
>
> Your code is taking a String and encoding it in the file under UTF-8.
> UTF-8 does not have the characters you need so it tries to do it's best
> for you and 'fails'.
> It gives you a result, which you are retrieving from  a file, copying
> and pasting into an email.. This flow also involves a number of
> interpretations too.
>
> I don't see you have stated what you want to do with your Unicode value
> yet?  If you do want it to persist in a file encode in UTF-8 then you
> need to convert the Unicode bytes into a format that can be held in this
> encoding.  Perhaps 're-escaping' or BASE-64 encoding it.
>
> Personally I think you should also be specifying the value within the
> Ant xml in UTF-8, so you comply with the encoding statement at the top
> of the xml.  BASE-64 or escaped might do you.
>
> --
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Passing multi-byte strings from ANT using task

Posted by Steve Loughran <st...@apache.org>.
- You should specify unicode content in the XML as valid XML content, 
not escaped \u0123 style.

-The <java> task and things that use it set up the command line; there's 
a risk that it could get in the way and not preserve high unicode 
content. If so, its something we need to test for

-A more reliable way of passing data down to your app could be for Ant 
to pass down the name of a .properties file, a file loaded explicitly by 
the application with Properties.load() . Even better, use the XML format 
for properties and load with with properties.loadXML(). This would take 
the command line and ant out of the loop and be more likely to work

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Passing multi-byte strings from ANT using task

Posted by Mark Salter <ma...@talktalk.net>.
Shashidhar Kotta wrote:
> Hi,
> 
> I have tried with your ANT code but it is displaying ?m?n??? only.

Your code is encoding the String it sees into UTF-8, this is likely the
right output, but not what you expected?

You need to think through what you are trying to do, but from this
result, I would suggest that your code might be receiving the Unicode
value correctly from Ant.  I would be surprised though.  To check you
would need to print the string in a Unicode 'aware' way.

To guide, we need to know what you intend to do with this string, but
this is less of an Ant question and more a Java question.

>
> 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я??

Your code is taking a String and encoding it in the file under UTF-8.
UTF-8 does not have the characters you need so it tries to do it's best
for you and 'fails'.
It gives you a result, which you are retrieving from  a file, copying
and pasting into an email.. This flow also involves a number of
interpretations too.

I don't see you have stated what you want to do with your Unicode value
yet?  If you do want it to persist in a file encode in UTF-8 then you
need to convert the Unicode bytes into a format that can be held in this
encoding.  Perhaps 're-escaping' or BASE-64 encoding it.

Personally I think you should also be specifying the value within the
Ant xml in UTF-8, so you comply with the encoding statement at the top
of the xml.  BASE-64 or escaped might do you.

-- 
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Passing multi-byte strings from ANT using task

Posted by Rez <po...@hotmail.com>.
Not sure if your problem with the exec task was resolved or not but from your earlier example I see that the syntax of your exec command is wrong as you cannot directly invoke a batch file directly within Ant and have to pass it to the system command first, see the exec's examples:
 
<target name="help">  <exec executable="cmd">    <arg value="/c"/>    <arg value="ant.bat"/>    <arg value="-p"/>  </exec></target>> Subject: RE: Passing multi-byte strings from ANT using <sysproperty> task> Date: Thu, 11 Dec 2008 15:57:39 +0530> From: Shashidhar.Kotta@ness.com> To: user@ant.apache.org> > > 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 <Sh...@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.
_________________________________________________________________
Send e-mail faster without improving your typing skills.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008

RE: Passing multi-byte strings from ANT using task

Posted by Shashidhar Kotta <Sh...@ness.com>.
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.

Re: Passing multi-byte strings from ANT using task

Posted by Mark Salter <ma...@talktalk.net>.
Shashidhar Kotta wrote:

> We are using “–Dfile.encoding=UTF8” jvm args and now we are able to
> pass multi-byte strings from ANT to Java and even from the cmd to
> java also.
>
> But in our case we have string which has the characters from
> different regions. That's why when we set the system to Korean region
> and pass 'hmỘnяỘỆ' then only the 'я' characters is getting passed
> properly. Other strings are coming as '?'(i.e 'hm?nя??')

Can you explain step by step what you are trying to achieve?

How are you viewing the contents of the file you are producing?  Are you
using a viewing method that supports the UTF-8 encoding properly?

This page:-

	http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8

describes nicely the encoding structures you are dealing with.
I'm sorry to say that I had an incorrect view of what could and could
not be represented in this encoding.  I see now I was incorrectly
confusing UTF-8 with ASCII-8!

If you are :-

  specifying various strings within an ant build.xml file,
  to have ant pass them through to your code,
  which then writes the String to a file...

Then you need to be careful with what tools you use to view and check
(perhaps edit) the result.

How are you checking your result? What commands or application are you
using to see 'hm?nя??' ?

-- 
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Passing multi-byte strings from ANT using task

Posted by Shashidhar Kotta <Sh...@ness.com>.
Hi All,

Thanks for all your inputs. We are half-way through.
We are using “–Dfile.encoding=UTF8” jvm args and now we are able to pass multi-byte strings from ANT to Java and even from the cmd to java also. This works when we set the system to a particular region and send the multi-byte characters FROM THAT PARTICULAR region only. That means if the system is set to Korean region then we can pass the '뒷다리' Korean string from ANT to java.

But in our case we have string which has the characters from different regions. That's why when we set the system to Korean region and pass 'hmỘnяỘỆ' then only the 'я' characters is getting passed properly. Other strings are coming as '?'(i.e 'hm?nя??')

Thanks,
Shashidhar Kotta.

-----Original Message-----
From: Shashidhar Kotta 
Sent: Thursday, December 11, 2008 3:58 PM
To: Ant Users List
Subject: RE: Passing multi-byte strings from ANT using <sysproperty> task

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.

Re: Passing multi-byte strings from ANT using task

Posted by Greg Roodt <gr...@gmail.com>.
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.
>

RE: Passing multi-byte strings from ANT using task

Posted by Shashidhar Kotta <Sh...@ness.com>.
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.

Re: Passing multi-byte strings from ANT using task

Posted by Greg Roodt <gr...@gmail.com>.
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.
>