Re: How is this conditional able to execute?
- From: "Brett" <no@xxxxxxxx>
- Date: Sun, 17 Apr 2005 19:36:14 -0400
"Stephany Young" <noone@localhost> wrote in message
news:%23hNf834QFHA.3988@xxxxxxxxxxxxxxxxxxxxxxx
> What test are you using to determine that returndata.ToString = ""?
>
> Are you , for example, executing a:
>
> Console.Writeline("returndata.ToString = " & returndata.ToString)
>
> and getting the result:
>
> returndata.ToString =
>
> Your comment about returndata 'always' being 8193 bytes gives us the clue
> as what is happening.
>
> I suspect that returndata is padded with null characters (chr(0)).
>
> The Trim function (aka Microsoft.VisualBasic.Trim) only 'trims' leading
> and trailing Space characters.
>
> The String.Trim Method 'trims' leading and trailing whitespace characters.
> 'whitespace' comprises a number of characters including the null character
> (chr(0)).
>
> I think that if you change the line:
>
> Dim returndata As String = Trim(Encoding.UTF8.GetString(bytes))
>
> to
>
> Dim returndata As String = Encoding.UTF8.GetString(bytes).Trim()
>
> then the test will work correctly.
That doesn't work either. In some cases, bytes will come in as a zero byte
array with length 8193. Every element in that array will be zero.
returndata is assigned and its length becomes 8193 as well.
.
- Follow-Ups:
- Re: How is this conditional able to execute?
- From: Stephany Young
- Re: How is this conditional able to execute?
- References:
- How is this conditional able to execute?
- From: Brett
- Re: How is this conditional able to execute?
- From: Stephany Young
- Re: How is this conditional able to execute?
- From: Brett
- Re: How is this conditional able to execute?
- From: Stephany Young
- Re: How is this conditional able to execute?
- From: Brett
- Re: How is this conditional able to execute?
- From: Stephany Young
- How is this conditional able to execute?
- Prev by Date: access all items in a datagrid
- Next by Date: Re: Populating WinForms DataGrid
- Previous by thread: Re: How is this conditional able to execute?
- Next by thread: Re: How is this conditional able to execute?
- Index(es):
Relevant Pages
|