Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-08-2002, 05:43 AM   #1
Mattarm
Registered User
 
Join Date: Feb 2001
Location: Melbourne
Posts: 47
Default Special characters & ASP

Got a bit of a problem.

I have created an interface to allow the user to update some text on thier website using flash/ASP/Access. In the large text box all works until you use any of the following characters:

# & % :

all text beyonf these characters is ignored in the DB update.

How can I use these characters?

Cheers
Mattarm is offline   Reply With Quote
Old 08-08-2002, 08:30 AM   #2
mad_A
The Zen of ActionScript
 
mad_A's Avatar
 
Join Date: Mar 2001
Location: Dublin, Ireland
Posts: 713
Default

You can run some code on the textbox to swap those characters for their html escape characters before they are sent to the dB. Something like this...

function replaceAmpersand(myString){
tempArray=new Array();
tempArray=myString.split("&");
myString=tempArray[0];
for(i=1;<tempArray.length;i++){
myString=myString + "&amp;" +tempArray[i];
return myString;
}
mad_A is offline   Reply With Quote
Old 08-09-2002, 02:07 AM   #3
Mattarm
Registered User
 
Join Date: Feb 2001
Location: Melbourne
Posts: 47
Default

Thanks Mad_A,
Interesting function, unfortunately is didn't work at first. I replaced the "& " for "&amp;" (and a multitude of other thies) but still joy. as soon as there is an & in the script is seems to think it is a new variable when I try to POST.

I then thought a bit more (coffee, coffee and more coffee) and realised that I was thinking backwards. The escape sequences I used were wrong. I modified the data in the database to include the characters, modified the ASP to return the string to a browser window and checked the result and there it was.

& = %26 not &amp;
# = %23
% = %25
: = %3A

I will now reform your function to include these additional characters. It might take a little while on large blocks of text but I am sure it is the on the right track

One strange thing that I also discovered is that the \ character is changed to / in the return from the DB.

Thankx again,
Mat
Mattarm is offline   Reply With Quote
Old 08-09-2002, 02:19 PM   #4
mad_A
The Zen of ActionScript
 
mad_A's Avatar
 
Join Date: Mar 2001
Location: Dublin, Ireland
Posts: 713
Default

sorry, should have realised that myself - & a m p ; is html escape. Doh!

Also realised that where I was saying & a m p ; in the function, that this forum was changing that to & (guess it is web based...)

Let me know how you get on with it.


A

Last edited by mad_A; 08-09-2002 at 02:24 PM.
mad_A is offline   Reply With Quote
Old 08-11-2002, 11:08 PM   #5
Mattarm
Registered User
 
Join Date: Feb 2001
Location: Melbourne
Posts: 47
Default

Thanks for the help mad_A.

Got to the bottom of the problem. Also adapted your function to inlude the other characters that were giving me grief, even \r.

Works a treat now so I am now that much closer to letting the client loose on the site.

Thanks again
Mattarm is offline   Reply With Quote
Old 08-13-2002, 12:20 AM   #6
Mattarm
Registered User
 
Join Date: Feb 2001
Location: Melbourne
Posts: 47
Default

The guys over at Friends of Ed showed yet another way to skin this cat;

textvar = escape(textvar);

simple, elegant and works.
Mattarm is offline   Reply With Quote
Old 08-13-2002, 05:32 PM   #7
mad_A
The Zen of ActionScript
 
mad_A's Avatar
 
Join Date: Mar 2001
Location: Dublin, Ireland
Posts: 713
Default

hmmm...

yeah, I like the look of that. Simple code is always the best.
mad_A is offline   Reply With Quote
Old 08-15-2002, 08:55 AM   #8
xxlm
Meuh? MMeuh!
 
xxlm's Avatar
 
Join Date: Sep 2001
Location: Auckland - New Zealand
Posts: 3,050
Send a message via ICQ to xxlm Send a message via AIM to xxlm Send a message via MSN to xxlm Send a message via Yahoo to xxlm
Default

Hi everybody...
I've made something you may like...
http://www.actionscript.org/showMovie.php?id=513

Plz, give feedbacks...
__________________
I'm a froggy, so excuse me for my poor english
Blog - Dev By MX
For any jobs go on my blog on the contact page...
xxlm is offline   Reply With Quote
Old 08-16-2002, 01:59 AM   #9
Mattarm
Registered User
 
Join Date: Feb 2001
Location: Melbourne
Posts: 47
Default

Hi XXLM,

Saw your work the other day (after I solved the problem of course) but have looked at the file to see more about this problem. I only wish I had found your file earlier, it would have saved many long, lonely hours wracking my brain.

The truth is that you are never the first to find a problem and there is always someone willing to show the way. This is the best thing about the flash community - the willingness to help and share ideas.

Thanks to everyone
Matt
Mattarm is offline   Reply With Quote
Old 08-16-2002, 02:51 AM   #10
xxlm
Meuh? MMeuh!
 
xxlm's Avatar
 
Join Date: Sep 2001
Location: Auckland - New Zealand
Posts: 3,050
Send a message via ICQ to xxlm Send a message via AIM to xxlm Send a message via MSN to xxlm Send a message via Yahoo to xxlm
Default

Joy of helping people...
__________________
I'm a froggy, so excuse me for my poor english
Blog - Dev By MX
For any jobs go on my blog on the contact page...
xxlm is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:39 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.