I think that the carriage return that we send from a TextArea is just \n and Windows expects it to be \r\n.  What if you try iterating through the string and replacing any \n with \r\n and then executing the web service.

 

Var newStr : String = “”;

Var sourceStr : String = myTextArea.text;

For (var c : Number = 0; c < sourceStr.length; c++)

{

  Var ch : String = sourceStr.getCharAt(c);

  if (ch == ‘\n’)

   newStr += ‘\r’;

  newStr += ch;

}

myService.myOp(newStr);

 

Actually, a more efficient implementation might be:

 

var arr : Array = myTextArea.text.split(‘\n’);

var newStr : String = arr.join(“\r\n”);

myService.myOp(newStr);

 

Let us know if that helps,

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com]
Sent: Monday, April 18, 2005 12:49 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] carriage return via web service

 

Well I'm stumped.

I am calling a .NET web service that inserts text from a TextArea into
the database. When I try the Webservice from a .NET  HTML form, if I
have carriage returns in the text it saves them to the database just
fine.

When I call the webservice from FLEX and I have carriage returns in
the text, the character gets dropped. I confirmed the Keycode is
correct (ASCII 13), and when I run the Application in flexbuilder and
view the network monitor, the SOAP packet seems to have the carriage
returns in place.

The carriage return seems to be getting lost before the SOAP packet
reaches the  web service. I'm wondering if there is something in the
underlying JRun application that is removing the character.

Has anyone else run into this? I've searched the groups for anything
related to "carriage return" or "line feed" and have come up empty.

Thanks for any help.



Yahoo! Groups Links

Reply via email to