|
|
 |
Re: FN-FORUM: ASP to Flash comma delimter problem
date posted 14th March 2003 15:46
Hi Paul,
>I'm passing data from ASP to Flash by Response.Writing a string. This string
>uses commas to seperate values. However some of the actual values (that come
>from a database) already have commas in them. Has anyone come across this
>before. I think that other characters might also be causing me problems such
>as '+' signs. Any help would be greatly appreciated. Basically I think I
>need to come up with an ASP function that will replace the problem
>characters and then an actionScript function that does the reverse.
>
I'm more of a FlashPHP bod myself, but basically you should use
Server.URLEncode() to encode your string before setting it up as a
variable. Flash will decode this automatically, meaning that your
variables will be ready for use as soon as they're loaded.
The problem of having the character you're using for your own separation
cropping up in text can be solved one of two ways:
1) Rather than using CSV, separate the values into individual variables.
&myVars=1,147,234,1234
...becomes...
myVar1=1&myVar2=147&myVar3=234&myVar4=1234
2) Choose a different character to separate your values - one that won't
crop up in the text.
Using the pipe symbol (|)...
&myVars=1,147,234,1234
...becomes...
&myVars=1|147|234|1234
You could also try formatting your data as XML and using the XML object
in Flash to load+decode the data, or try Flash Remoting, which will
allow you to send objects, strings etc from ASP to Flash and back
without having to URL-encode it, though neither of these will solve the
CSV issue as that's inherent to the data you're using and not how Flash
is processing it.
HTH
Regards,
Steve
|
 |
|