Textarea truncates string of binary data in unpredictable way 
Author Message
 Textarea truncates string of binary data in unpredictable way

I've written an ActiveX control that collects binary audio data from the
user's browser. The user speaks into the microphone and my ActiveX
recorder control returns the binary audio data as a BSTR. I want to pass
this BSTR of binary data to another ActiveX control that is sitting on
an ASP page on my web server for processing. (When I pass the BSTR to
that other ActiveX control on the same computer using client-side
JavaScript, I have no problem, but that can't be my final solution; the
other ActiveX control must be on the server.)

I don't want to do a binary file upload of this audio data because I
don't want to mess around with the user's filesystem. Therefore I set
the value of a hidden form's textarea to the value of my BSTR of audio
data and submit that using method=POST and
enctype="multipart/form-data". Since a BSTR is UTF-16, I set the
textarea's accept-charset property to "unicode" and I put a tag in the
html page's header that reads <META HTTP-EQUIV="Content-Type"
content="text/html; charset=unicode"> to ensure there are no forced
conversions between unicode and ascii (or whatever) in the textarea that
would violate the integrity of my binary code, which, as mentioned
before, is represented by a BSTR of unicode characters.

Unfortunately I've noticed that when I set the textarea's value to the
value of my BSTR of binary audio data, the string gets truncated at an
unpredictable point. That is, when my recorder ActiveX control returns a
BSTR about 22048 characters long, and then I set the textarea to the
value of that BSTR, the length of the textarea comes out as 621, or,
6018, or 811, or 1620, or 5446 - never anywhere near 22048. I don't
think I'm running up against a built-in maximum capacity of the textarea
control because the string always gets truncated at a different point.

Is there a unicode character that, when encountered, triggers the
equivalent of an EOF for a textarea? How can I escape it? Is it possible
for binary data to be passed from an ActiveX control, through a BSTR, to
a textarea, submitted over the Internet to the server without munging
the data, or am I deluding myself?

Can anyone help me? Thank you very much.

_____________
James Kennedy

*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!



Mon, 26 Sep 2005 01:30:08 GMT  
 Textarea truncates string of binary data in unpredictable way
Try the wsh group or net.jscript group.

Sound interesting.

javascript alone will not do it.

Your are talking application servers; and that never was Netscape's domain


Quote:
> I've written an ActiveX control that collects binary audio data from the
> user's browser. The user speaks into the microphone and my ActiveX
> recorder control returns the binary audio data as a BSTR. I want to pass
> this BSTR of binary data to another ActiveX control that is sitting on
> an ASP page on my web server for processing. (When I pass the BSTR to
> that other ActiveX control on the same computer using client-side
> JavaScript, I have no problem, but that can't be my final solution; the
> other ActiveX control must be on the server.)

> I don't want to do a binary file upload of this audio data because I
> don't want to mess around with the user's filesystem. Therefore I set
> the value of a hidden form's textarea to the value of my BSTR of audio
> data and submit that using method=POST and
> enctype="multipart/form-data". Since a BSTR is UTF-16, I set the
> textarea's accept-charset property to "unicode" and I put a tag in the
> html page's header that reads <META HTTP-EQUIV="Content-Type"
> content="text/html; charset=unicode"> to ensure there are no forced
> conversions between unicode and ascii (or whatever) in the textarea that
> would violate the integrity of my binary code, which, as mentioned
> before, is represented by a BSTR of unicode characters.

> Unfortunately I've noticed that when I set the textarea's value to the
> value of my BSTR of binary audio data, the string gets truncated at an
> unpredictable point. That is, when my recorder ActiveX control returns a
> BSTR about 22048 characters long, and then I set the textarea to the
> value of that BSTR, the length of the textarea comes out as 621, or,
> 6018, or 811, or 1620, or 5446 - never anywhere near 22048. I don't
> think I'm running up against a built-in maximum capacity of the textarea
> control because the string always gets truncated at a different point.

> Is there a unicode character that, when encountered, triggers the
> equivalent of an EOF for a textarea? How can I escape it? Is it possible
> for binary data to be passed from an ActiveX control, through a BSTR, to
> a textarea, submitted over the Internet to the server without munging
> the data, or am I deluding myself?

> Can anyone help me? Thank you very much.

> _____________
> James Kennedy

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Mon, 26 Sep 2005 12:46:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. convert binary data to string data

2. binary data in textarea

3. binary data in textarea

4. upload both text data and binary data

5. BinaryRead - howto convert binary string back to string array

6. Truncated Data Error

7. String truncates all but 1st word in Form Input type text box

8. String truncating

9. string returned from sql server truncated at first space`

10. truncate a string

11. how much data will a textarea hold before truncating?

12. operating data transfers between two textareas client-side

 

 
Powered by phpBB® Forum Software