I have written an asp/vbscript script that returns some personal details to
a flash frontend using the following code.

response.write "vRESPONSE=success&vUSER_ID=45&vNAME=Fred&vCOMPANY=some
company"

This works fine until the variable value has an ampersand in it i.e

response.write "vRESPONSE=success&vUSER_ID=45&vNAME=Fred&vCOMPANY=Fred &
Co."

and then it fails since it looks like the start of a new variable name.

So I then tried to urlencode the values so ampesand became %26, which works
fine for the ampersand but then some other characters get screwed up,
particuarly extended unicide values.

Could anyone give me any pointers on how I should be doingf this?

Many thanks

Dave

Re: response.write question by Anthony

Anthony
Mon Jan 29 08:05:24 CST 2007


"Dave" <david@nospam.co.uk> wrote in message
news:j6kvh.61677$v4.34852@newsfe3-win.ntli.net...
> I have written an asp/vbscript script that returns some personal details
to
> a flash frontend using the following code.
>
> response.write "vRESPONSE=success&vUSER_ID=45&vNAME=Fred&vCOMPANY=some
> company"
>
> This works fine until the variable value has an ampersand in it i.e
>
> response.write "vRESPONSE=success&vUSER_ID=45&vNAME=Fred&vCOMPANY=Fred &
> Co."
>
> and then it fails since it looks like the start of a new variable name.
>
> So I then tried to urlencode the values so ampesand became %26, which
works
> fine for the ampersand but then some other characters get screwed up,
> particuarly extended unicide values.
>
> Could anyone give me any pointers on how I should be doingf this?
>
> Many thanks
>
> Dave
>

I don't know much about flash or how it's reading this data you are sending
it.

However urlencode will use the current codepage to encode a URL. If you
need to support a wide range of characters you need to be using codepage
65001 (UTF-8)


Dim lPrevCodePage : lPrevCodePage = Session.CodePage
Session.CodePage = 65001

sCompany= Server.UrlEncode(sCompany)

Session.CodePage = lPrevCodePage

Response.CharSet = "UTF-8"

Response.Write "vRESPONSE=success&vUSER_ID=45&vNAME=Fred&vCOMPANY=" & _
sCompany


That's not say that'll work it will depend on whether flash actually
understands it is getting UTF-8 encoding.



Re: response.write question by Dave

Dave
Mon Jan 29 08:28:49 CST 2007

Thanks Anthony

I'll give this a try

"Anthony Jones" <Ant@yadayadayada.com> wrote in message
news:u0iKH66QHHA.4692@TK2MSFTNGP05.phx.gbl...
>
> "Dave" <david@nospam.co.uk> wrote in message
> news:j6kvh.61677$v4.34852@newsfe3-win.ntli.net...
>> I have written an asp/vbscript script that returns some personal details
> to
>> a flash frontend using the following code.
>>
>> response.write "vRESPONSE=success&vUSER_ID=45&vNAME=Fred&vCOMPANY=some
>> company"
>>
>> This works fine until the variable value has an ampersand in it i.e
>>
>> response.write "vRESPONSE=success&vUSER_ID=45&vNAME=Fred&vCOMPANY=Fred &
>> Co."
>>
>> and then it fails since it looks like the start of a new variable name.
>>
>> So I then tried to urlencode the values so ampesand became %26, which
> works
>> fine for the ampersand but then some other characters get screwed up,
>> particuarly extended unicide values.
>>
>> Could anyone give me any pointers on how I should be doingf this?
>>
>> Many thanks
>>
>> Dave
>>
>
> I don't know much about flash or how it's reading this data you are
> sending
> it.
>
> However urlencode will use the current codepage to encode a URL. If you
> need to support a wide range of characters you need to be using codepage
> 65001 (UTF-8)
>
>
> Dim lPrevCodePage : lPrevCodePage = Session.CodePage
> Session.CodePage = 65001
>
> sCompany= Server.UrlEncode(sCompany)
>
> Session.CodePage = lPrevCodePage
>
> Response.CharSet = "UTF-8"
>
> Response.Write "vRESPONSE=success&vUSER_ID=45&vNAME=Fred&vCOMPANY=" & _
> sCompany
>
>
> That's not say that'll work it will depend on whether flash actually
> understands it is getting UTF-8 encoding.
>
>



Re: response.write question by Bob

Bob
Mon Jan 29 18:53:26 CST 2007

Dave wrote:

> So I then tried to urlencode the values so ampesand became %26, which works
> fine for the ampersand but then some other characters get screwed up,
> particuarly extended unicide values.
>
> Could anyone give me any pointers on how I should be doingf this?


If ampersand is the only one you need to care about,
perhaps a simple str = Replace(str, "&", "%26")



Bob
--