You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Brown, Carlton" <Ca...@BellSouth.com> on 2007/03/12 00:48:56 UTC

Escaping double quotes in properties?

I'm trying to store double quotes in a property, to print out a phrase
like:   
It's spelled "potatoe"

The manual provides only this cute bit of advice:  
Want unusual characters?  Escape them \u0456 or \" style.

Problem is, it doesn't seem to work, or I'm misunderstanding it:
<?xml version="1.0"?> 
<project name="test" default="build">
        <target name="build">
                <property name="foo" value="It's spelled \"potatoe\""/>
                <echo message="${foo}"/>
        </target>
</project>

Buildfile: test.xml

BUILD FAILED
/tmp/test.xml:4: Element type "property" must be followed by either
attribute specifications, ">" or "/>".

Total time: 0 seconds

I also tried \u201C and \u201D which I believe are the correct unicode
quotes, but Ant just printed them literally.

Help?




*****

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA625



Re: Escaping double quotes in properties?

Posted by red i <aa...@redidevelopmentgroup.org>.
Either spelling is fine.

I know there are some places you can use &amp;quot; to symbolize a double
quote, but let's say the quote about the potato(e) in this case is an
argument to a javascript function...

I've encountered the same problem, compounded by javascript syntax within
the html property value, like:

    <property name="foo" onclick="return DoSomething('Potato', 'Potato"e"
with an e')">

The problem is that to the browser, the HTML property ONCLICK is actually:

    onclick="return DoSomething('Potato', 'Potato"

because it cares not for what goes between those quotes.  Unfortunately I've
tried many alternatives, such as using javascript escape character ( \"
would create a " in JS without ending a literal segment of code).  It
doesn't work because it's not the javascript being misrepresented, its the
HTML.

You can't really even get away with switching the double and single quotes
so that the property value is enclosed in single quotes and double quotes
are used to enclose the literal arguments, like:

    <property name="foo" onclick='return DoSomething("Potato", "Potato"e"
with an e")'>

            or

    <property name="foo" value='It's spelled "potatoe"'/>

Because, as in the case of property "foo", you run into the same problem now
with the single quote.  Now the HTML property's value becomes:

    value='It'

So, what we really need to know, from anyone who does, is how one might
escape an HTML property value, without using &amp;quot; so that it is
completely transparent to the javascript that may be contained in that
value.









Dale Anson wrote:
> 
> Keep in mind, though, that in fact it's spelled "potato".
> 
> bill/wilandra wrote:
>> Try using &quot; -- 
>> <property name="foo" value="It's spelled &quot;potatoe&quot;"/>
>> HTH Bill
>>
>> -----Original Message-----
>> From: Brown, Carlton [mailto:Carlton.Brown@BellSouth.com] 
>> Sent: Sunday, March 11, 2007 3:49 PM
>> To: Ant Users List
>> Subject: Escaping double quotes in properties?
>>
>> I'm trying to store double quotes in a property, to print out a phrase
>> like:   
>> It's spelled "potatoe"
>>
>> The manual provides only this cute bit of advice:  
>> Want unusual characters?  Escape them \u0456 or \" style.
>>
>> Problem is, it doesn't seem to work, or I'm misunderstanding it:
>> <?xml version="1.0"?>
>> <project name="test" default="build">
>>         <target name="build">
>>                 <property name="foo" value="It's spelled \"potatoe\""/>
>>                 <echo message="${foo}"/>
>>         </target>
>> </project>
>>
>> Buildfile: test.xml
>>
>> BUILD FAILED
>> /tmp/test.xml:4: Element type "property" must be followed by either
>> attribute specifications, ">" or "/>".
>>
>> Total time: 0 seconds
>>
>> I also tried \u201C and \u201D which I believe are the correct unicode
>> quotes, but Ant just printed them literally.
>>
>> Help?
>>
>>
>>
>>
>> *****
>>
>> The information transmitted is intended only for the person or entity to
>> which it is addressed and may contain confidential, proprietary, and/or
>> privileged material. Any review, retransmission, dissemination or other
>> use
>> of, or taking of any action in reliance upon this information by persons
>> or
>> entities other than the intended recipient is prohibited. If you received
>> this in error, please contact the sender and delete the material from all
>> computers. GA625
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Escaping-double-quotes-in-properties--tf3386419.html#a9629079
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Escaping double quotes in properties?

Posted by red i <aa...@redidevelopmentgroup.org>.
Either spelling is fine.

I know there are some places you can use &amp;quot; to symbolize a double
quote, but let's say the quote about the potato(e) in this case is an
argument to a javascript function...

I've encountered the same problem, compounded by javascript syntax within
the html property value, like:

    <property name="foo" onclick="return DoSomething('Potato', 'Potato"e"
with an e')">

The problem is that to the browser, the HTML property ONCLICK is actually:

    onclick="return DoSomething('Potato', 'Potato"

because it cares not for what goes between those quotes.  Unfortunately I've
tried many alternatives, such as using javascript escape character ( \"
would create a " in JS without ending a literal segment of code).  It
doesn't work because it's not the javascript being misrepresented, its the
HTML.

You can't really even get away with switching the double and single quotes
so that the property value is enclosed in single quotes and double quotes
are used to enclose the literal arguments, like:

    <property name="foo" onclick='return DoSomething("Potato", "Potato"e"
with an e")'>

            or

    <property name="foo" value='It's spelled "potatoe"'/>

Because, as in the case of property "foo", you run into the same problem now
with the single quote.  Now the HTML property's value becomes:

    value='It'

So, what we really need to know, from anyone who does, is how one might
escape an HTML property value, without using &quot; so that it is completely
transparent to the javascript that may be contained in that value.









Dale Anson wrote:
> 
> Keep in mind, though, that in fact it's spelled "potato".
> 
> bill/wilandra wrote:
>> Try using &quot; -- 
>> <property name="foo" value="It's spelled &quot;potatoe&quot;"/>
>> HTH Bill
>>
>> -----Original Message-----
>> From: Brown, Carlton [mailto:Carlton.Brown@BellSouth.com] 
>> Sent: Sunday, March 11, 2007 3:49 PM
>> To: Ant Users List
>> Subject: Escaping double quotes in properties?
>>
>> I'm trying to store double quotes in a property, to print out a phrase
>> like:   
>> It's spelled "potatoe"
>>
>> The manual provides only this cute bit of advice:  
>> Want unusual characters?  Escape them \u0456 or \" style.
>>
>> Problem is, it doesn't seem to work, or I'm misunderstanding it:
>> <?xml version="1.0"?>
>> <project name="test" default="build">
>>         <target name="build">
>>                 <property name="foo" value="It's spelled \"potatoe\""/>
>>                 <echo message="${foo}"/>
>>         </target>
>> </project>
>>
>> Buildfile: test.xml
>>
>> BUILD FAILED
>> /tmp/test.xml:4: Element type "property" must be followed by either
>> attribute specifications, ">" or "/>".
>>
>> Total time: 0 seconds
>>
>> I also tried \u201C and \u201D which I believe are the correct unicode
>> quotes, but Ant just printed them literally.
>>
>> Help?
>>
>>
>>
>>
>> *****
>>
>> The information transmitted is intended only for the person or entity to
>> which it is addressed and may contain confidential, proprietary, and/or
>> privileged material. Any review, retransmission, dissemination or other
>> use
>> of, or taking of any action in reliance upon this information by persons
>> or
>> entities other than the intended recipient is prohibited. If you received
>> this in error, please contact the sender and delete the material from all
>> computers. GA625
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Escaping-double-quotes-in-properties--tf3386419.html#a9629079
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: Escaping double quotes in properties?

Posted by Dale Anson <da...@grafidog.com>.
Keep in mind, though, that in fact it's spelled "potato".

bill/wilandra wrote:
> Try using &quot; -- 
> <property name="foo" value="It's spelled &quot;potatoe&quot;"/>
> HTH Bill
>
> -----Original Message-----
> From: Brown, Carlton [mailto:Carlton.Brown@BellSouth.com] 
> Sent: Sunday, March 11, 2007 3:49 PM
> To: Ant Users List
> Subject: Escaping double quotes in properties?
>
> I'm trying to store double quotes in a property, to print out a phrase
> like:   
> It's spelled "potatoe"
>
> The manual provides only this cute bit of advice:  
> Want unusual characters?  Escape them \u0456 or \" style.
>
> Problem is, it doesn't seem to work, or I'm misunderstanding it:
> <?xml version="1.0"?>
> <project name="test" default="build">
>         <target name="build">
>                 <property name="foo" value="It's spelled \"potatoe\""/>
>                 <echo message="${foo}"/>
>         </target>
> </project>
>
> Buildfile: test.xml
>
> BUILD FAILED
> /tmp/test.xml:4: Element type "property" must be followed by either
> attribute specifications, ">" or "/>".
>
> Total time: 0 seconds
>
> I also tried \u201C and \u201D which I believe are the correct unicode
> quotes, but Ant just printed them literally.
>
> Help?
>
>
>
>
> *****
>
> The information transmitted is intended only for the person or entity to
> which it is addressed and may contain confidential, proprietary, and/or
> privileged material. Any review, retransmission, dissemination or other use
> of, or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. If you received
> this in error, please contact the sender and delete the material from all
> computers. GA625
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>   

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


RE: Escaping double quotes in properties?

Posted by bill/wilandra <bi...@wilandra.com>.
Try using &quot; -- 
<property name="foo" value="It's spelled &quot;potatoe&quot;"/>
HTH Bill

-----Original Message-----
From: Brown, Carlton [mailto:Carlton.Brown@BellSouth.com] 
Sent: Sunday, March 11, 2007 3:49 PM
To: Ant Users List
Subject: Escaping double quotes in properties?

I'm trying to store double quotes in a property, to print out a phrase
like:   
It's spelled "potatoe"

The manual provides only this cute bit of advice:  
Want unusual characters?  Escape them \u0456 or \" style.

Problem is, it doesn't seem to work, or I'm misunderstanding it:
<?xml version="1.0"?>
<project name="test" default="build">
        <target name="build">
                <property name="foo" value="It's spelled \"potatoe\""/>
                <echo message="${foo}"/>
        </target>
</project>

Buildfile: test.xml

BUILD FAILED
/tmp/test.xml:4: Element type "property" must be followed by either
attribute specifications, ">" or "/>".

Total time: 0 seconds

I also tried \u201C and \u201D which I believe are the correct unicode
quotes, but Ant just printed them literally.

Help?




*****

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential, proprietary, and/or
privileged material. Any review, retransmission, dissemination or other use
of, or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. GA625





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