You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Sean W. Ferguson" <se...@comcast.net> on 2003/08/19 02:26:05 UTC
[jelly] How to post XML with Unicode characters?
I am trying to post some XML that contains unicode characters to a
server. In the XML, if I set the encoding="ISO-8859-1" it works. The
problem is, I cannot set that in a jelly xml file for the post.
Example:
<http:post var="request" uri="http://sean:8080/dictionary/universe">
<http:header name="Content-Type" value="text/xml; charset=ISO-8859-1"/>
<http:header name="Content-Encoding" value="ISO-8859-1"/>
<http:body>
<filerequest method="save" type="single">
<file name="${name}">
<core:forEach var="property"
items="${bean.dynaClass.dynaProperties}">
<field id="${property.name}">${bean.get(property.name)}</field>
</core:forEach>
</file>
</filerequest>
</http:body>
</http:post>
It fails because some of the properties contain unicode characters.
What I want is to append this to the top:
<?xml version="1.0" encoding="ISO-8859-1"?>
But when I do, jelly complains about multiple xml tags saying there can
only be one.
Any suggestions?
Thanks
Re: [jelly] How to post XML with Unicode characters?
Posted by "Sean W. Ferguson" <se...@comcast.net>.
More specifically it is complaining about this character:
รป
Bill Keese wrote:
> You could try doing everything as UTF-8 rather than ISO-8859-1. Since
> UTF-8 is the default encoding for XML files, you don't need a <?xml
> version="1.0" encoding="ISO-8859-1"?> header. Not sure if that would
> solve your problem or not.
>
> Bill
>
> Sean W. Ferguson wrote:
>
>> I am trying to post some XML that contains unicode characters to a
>> server. In the XML, if I set the encoding="ISO-8859-1" it works. The
>> problem is, I cannot set that in a jelly xml file for the post.
>>
>> Example:
>> <http:post var="request" uri="http://sean:8080/dictionary/universe">
>> <http:header name="Content-Type" value="text/xml; charset=ISO-8859-1"/>
>> <http:header name="Content-Encoding" value="ISO-8859-1"/>
>> <http:body>
>> <filerequest method="save" type="single">
>> <file name="${name}">
>> <core:forEach var="property"
>> items="${bean.dynaClass.dynaProperties}">
>> <field id="${property.name}">${bean.get(property.name)}</field>
>> </core:forEach>
>> </file>
>> </filerequest>
>> </http:body>
>> </http:post>
>>
>> It fails because some of the properties contain unicode characters.
>> What I want is to append this to the top:
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> But when I do, jelly complains about multiple xml tags saying there
>> can only be one.
>>
>> Any suggestions?
>>
>> Thanks
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
Re: [jelly] How to post XML with Unicode characters?
Posted by Bill Keese <bi...@tech.beacon-it.co.jp>.
> Although if I set the encoding to UTF-8 in the jelly xml file, it
cannot parse the xml document. I have to set it to ISO-8859-1 for it to
parse the document.
Does "it" mean the HTTP server, or Jelly?
I'm not quite sure I follow what's going on. The <fileRequest> and
<file> tags are NOT jelly commands, right? That text is just past
literally to your HTTP server, right? So, your http request looks
something like this:
URL:
http://sean:8080/dictionary/universe
HEADERS:
Content-Type=text/xml; charset=UTF-8
Content-Encoding=UTF-8
BODY:
<filerequest method="save" type="single">
<file name="foo">
<field id="prop1">value1</field>
<field id="prop2">value2</field>
<field id="prop3">value3</field>
</file>
</filerequest>
In theory, jelly handles everything as a String, and then the HTTPClient
code converts that string to bytes according to the Content-Encoding
header field.
Bill
Sean W. Ferguson wrote:
> Although if I set the encoding to UTF-8 in the jelly xml file, it
> cannot parse the xml document. I have to set it to ISO-8859-1 for it
> to parse the document.
>
> Bill Keese wrote:
>
>> You could try doing everything as UTF-8 rather than ISO-8859-1.
>> Since UTF-8 is the default encoding for XML files, you don't need a
>> <?xml version="1.0" encoding="ISO-8859-1"?> header. Not sure if that
>> would solve your problem or not.
>>
>> Bill
>>
>> Sean W. Ferguson wrote:
>>
>>> I am trying to post some XML that contains unicode characters to a
>>> server. In the XML, if I set the encoding="ISO-8859-1" it works.
>>> The problem is, I cannot set that in a jelly xml file for the post.
>>>
>>> Example:
>>> <http:post var="request" uri="http://sean:8080/dictionary/universe">
>>> <http:header name="Content-Type" value="text/xml;
>>> charset=ISO-8859-1"/>
>>> <http:header name="Content-Encoding" value="ISO-8859-1"/>
>>> <http:body>
>>> <filerequest method="save" type="single">
>>> <file name="${name}">
>>> <core:forEach var="property"
>>> items="${bean.dynaClass.dynaProperties}">
>>> <field
>>> id="${property.name}">${bean.get(property.name)}</field>
>>> </core:forEach>
>>> </file>
>>> </filerequest>
>>> </http:body>
>>> </http:post>
>>>
>>> It fails because some of the properties contain unicode characters.
>>> What I want is to append this to the top:
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> But when I do, jelly complains about multiple xml tags saying there
>>> can only be one.
>>>
>>> Any suggestions?
>>>
>>> Thanks
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
Re: [jelly] How to post XML with Unicode characters?
Posted by "Sean W. Ferguson" <se...@comcast.net>.
Although if I set the encoding to UTF-8 in the jelly xml file, it cannot parse
the xml document. I have to set it to ISO-8859-1 for it to parse the document.
Bill Keese wrote:
> You could try doing everything as UTF-8 rather than ISO-8859-1. Since
> UTF-8 is the default encoding for XML files, you don't need a <?xml
> version="1.0" encoding="ISO-8859-1"?> header. Not sure if that would
> solve your problem or not.
>
> Bill
>
> Sean W. Ferguson wrote:
>
>> I am trying to post some XML that contains unicode characters to a
>> server. In the XML, if I set the encoding="ISO-8859-1" it works. The
>> problem is, I cannot set that in a jelly xml file for the post.
>>
>> Example:
>> <http:post var="request" uri="http://sean:8080/dictionary/universe">
>> <http:header name="Content-Type" value="text/xml; charset=ISO-8859-1"/>
>> <http:header name="Content-Encoding" value="ISO-8859-1"/>
>> <http:body>
>> <filerequest method="save" type="single">
>> <file name="${name}">
>> <core:forEach var="property"
>> items="${bean.dynaClass.dynaProperties}">
>> <field id="${property.name}">${bean.get(property.name)}</field>
>> </core:forEach>
>> </file>
>> </filerequest>
>> </http:body>
>> </http:post>
>>
>> It fails because some of the properties contain unicode characters.
>> What I want is to append this to the top:
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> But when I do, jelly complains about multiple xml tags saying there
>> can only be one.
>>
>> Any suggestions?
>>
>> Thanks
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
Re: [jelly] How to post XML with Unicode characters?
Posted by "Sean W. Ferguson" <se...@comcast.net>.
Thanks, that solved my problem.
Bill Keese wrote:
> You could try doing everything as UTF-8 rather than ISO-8859-1. Since
> UTF-8 is the default encoding for XML files, you don't need a <?xml
> version="1.0" encoding="ISO-8859-1"?> header. Not sure if that would
> solve your problem or not.
>
> Bill
>
> Sean W. Ferguson wrote:
>
>> I am trying to post some XML that contains unicode characters to a
>> server. In the XML, if I set the encoding="ISO-8859-1" it works. The
>> problem is, I cannot set that in a jelly xml file for the post.
>>
>> Example:
>> <http:post var="request" uri="http://sean:8080/dictionary/universe">
>> <http:header name="Content-Type" value="text/xml; charset=ISO-8859-1"/>
>> <http:header name="Content-Encoding" value="ISO-8859-1"/>
>> <http:body>
>> <filerequest method="save" type="single">
>> <file name="${name}">
>> <core:forEach var="property"
>> items="${bean.dynaClass.dynaProperties}">
>> <field id="${property.name}">${bean.get(property.name)}</field>
>> </core:forEach>
>> </file>
>> </filerequest>
>> </http:body>
>> </http:post>
>>
>> It fails because some of the properties contain unicode characters.
>> What I want is to append this to the top:
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> But when I do, jelly complains about multiple xml tags saying there
>> can only be one.
>>
>> Any suggestions?
>>
>> Thanks
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
Re: [jelly] How to post XML with Unicode characters?
Posted by Bill Keese <bi...@tech.beacon-it.co.jp>.
You could try doing everything as UTF-8 rather than ISO-8859-1. Since
UTF-8 is the default encoding for XML files, you don't need a <?xml
version="1.0" encoding="ISO-8859-1"?> header. Not sure if that would
solve your problem or not.
Bill
Sean W. Ferguson wrote:
> I am trying to post some XML that contains unicode characters to a
> server. In the XML, if I set the encoding="ISO-8859-1" it works. The
> problem is, I cannot set that in a jelly xml file for the post.
>
> Example:
> <http:post var="request" uri="http://sean:8080/dictionary/universe">
> <http:header name="Content-Type" value="text/xml; charset=ISO-8859-1"/>
> <http:header name="Content-Encoding" value="ISO-8859-1"/>
> <http:body>
> <filerequest method="save" type="single">
> <file name="${name}">
> <core:forEach var="property"
> items="${bean.dynaClass.dynaProperties}">
> <field id="${property.name}">${bean.get(property.name)}</field>
> </core:forEach>
> </file>
> </filerequest>
> </http:body>
> </http:post>
>
> It fails because some of the properties contain unicode characters.
> What I want is to append this to the top:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> But when I do, jelly complains about multiple xml tags saying there
> can only be one.
>
> Any suggestions?
>
> Thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>