Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12438

Re: Access the 3rd and rest elements of a Byte() (byte array)?

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Access the 3rd and rest elements of a Byte() (byte array)?
Date 2022-03-11 09:12 -0500
Organization A noiseless patient Spider
Message-ID <t0flce$jar$1@dont-email.me> (permalink)
References <7ikpiwc1wlb3.1jl0fbkule7nk$.dlg@40tude.net> <t07aqg$1ipv$2@gioia.aioe.org> <t07kg2$2b4$1@dont-email.me> <t0f7uf$v3c$1@dont-email.me>

Show all headers | View raw


"Ulrich Möller" <knobbi38@arcor.de> wrote

| set ds = createobject("adodb.stream")
| ds.open
| ds.charset = "windows-1252"
| ds.writetext "AaBbCc"
| ds.position = 0
| ds.type = 1
| arr = ds.read
|
| forĀ i = 0 to ubound(arr)
| Ā n = ascb(midb(arr,i+1,1))
| Ā h = cint(n)
| Ā wscript.echo h
| next
|
| With these lines I have no problem to access the array byte by byte.

    Very nice. Though still mysterious. The charset
should have defined the string as ANSI. When that
was converted to binary it should have been an
array of bytes corresponding to each character.
Instead, by referring to array elements
in the way that I was, using size, I was apparently
getting an array of two elements for each character,
representing a unicode character. So there's transparent
unicode conversion. Yuck. This seems to be similar to VB.
You can handle various text formats, and presumably
if you wrote that string to disk you'd get an ANSI file.
But behind the scenes it's dealing in unicode-16.

 

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Access the 3rd and rest elements of a Byte() (byte array)? JJ <jj4public@gmail.com> - 2022-03-08 06:24 +0700
  Re: Access the 3rd and rest elements of a Byte() (byte array)? "R.Wieser" <address@not.available> - 2022-03-08 11:22 +0100
    Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-08 08:07 -0500
      Re: Access the 3rd and rest elements of a Byte() (byte array)? "R.Wieser" <address@not.available> - 2022-03-08 21:15 +0100
        Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-08 16:57 -0500
        Re: Access the 3rd and rest elements of a Byte() (byte array)? JJ <jj4public@gmail.com> - 2022-03-09 10:58 +0700
          Re: Access the 3rd and rest elements of a Byte() (byte array)? "R.Wieser" <address@not.available> - 2022-03-09 10:39 +0100
      Re: Access the 3rd and rest elements of a Byte() (byte array)? Ulrich Möller <knobbi38@arcor.de> - 2022-03-11 11:23 +0100
        Re: Access the 3rd and rest elements of a Byte() (byte array)? "R.Wieser" <address@not.available> - 2022-03-11 13:14 +0100
        Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-11 09:12 -0500
          Re: Access the 3rd and rest elements of a Byte() (byte array)? Ulrich Möller <knobbi38@arcor.de> - 2022-03-11 18:41 +0100
            Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-11 15:58 -0500
        Re: Access the 3rd and rest elements of a Byte() (byte array)? JJ <jj4public@gmail.com> - 2022-03-12 06:24 +0700
          Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-11 19:30 -0500

csiph-web