I am using an HTTPService to send XML to a java server. Most of what I
send to the server arrives as expected, but certain characters are
corrupted somewhere along the way, such as degree sign and the Euro
currency symbol.  What we are seeing is that those sort of symbols have
an  (A + circumflex) inserted before them.  When I create the XML on
the client side, these corrupted characters do not appear anywhere in
the debugging process -- at least, not in the Debug window or printed to
the Console.  However, I do see the corrupted characters if I look at
the XML that is created using Flash Tracer.

In addition to trying to send the character itself, I have also tried
sending decimal and hexadecimal HTML entities, but these are treated the
same way -- they all have the  (A + circumflex) added before the
character.

The following is a test case to demonstrate the problem.  My project
uses Flex SDK 3.3.  Has anyone seen this problem before?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
     creationComplete="creationCompleteHandler(event)">
     <mx:Script>
         <![CDATA[
             import mx.rpc.events.FaultEvent;
             import mx.rpc.events.ResultEvent;
             import mx.rpc.http.HTTPService;
             import mx.events.FlexEvent;

             [Bindable] public var service:HTTPService;


             protected function creationCompleteHandler(e:FlexEvent):void
{
                 service = new HTTPService();
             }
             protected function buttonClickHandler(e:MouseEvent):void {
                
service.addEventListener(ResultEvent.RESULT,resultHandler);
                 service.addEventListener(FaultEvent.FAULT,faultHandler);
                 service.url =
"http://localhost/myapp/data/set-types?debug";;
                 service.contentType = "application/xml";
                 service.resultFormat = "e4x";
                 service.method = "POST";
                 service.request = getXml();
                 trace(service.request);
                 service.send();
             }
             protected function resultHandler(e:ResultEvent):void {
                 trace("result:");
                 trace(e.result);
             }
             protected function faultHandler(e:FaultEvent):void {
                 trace("fault");
             }
             protected function getXml():XML {
                 var myXml:XML = <dataTypes>
<type key="AV_AT" units="&#xb0;F" label="Air Temperature"
shortLabel="AirTemp"/>
<type key="AV_DP" units="\u00B0F" label="Dew Point"
shortLabel="DewPoint"/>
<type key="AV_SIGMA_T" units="&#176;" label="Sigma Theta"
shortLabel="ST"/>
<type key="AV_WD" units="°" label="Wind Direction"
shortLabel="WindDir"/>
</dataTypes>
                 return myXml;
             }
         ]]>
     </mx:Script>

     <mx:Button label="TEST SENDING XML" id="button"
click="buttonClickHandler(event)" x="10" y="30" />

</mx:Application>


Reply via email to