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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to