Re: How to write Binary data using VBScript?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi again,

[interlineated]

"mayayana" <mayaXXyana1a@xxxxxxxxxxxxxxxx> wrote in message
news:itioe.13737$M36.2495@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> There was an interesting article linked from Eric
> Lippert's article, about the history of character
> encoding:
>
> http://www.joelonsoftware.com/articles/Unicode.html
>
> (Joel Spolsky. He's another one from the Dave Barry
> school of technical writing.)

Actually, the "stuff" at the outset is just commercial "screaming". In the
marketplace, it's common to "scream" for attention with terribly
over-emphasized remarks, whether dire or humorous.

Once past that, a remarkably good article -- thanks for the reference. It's
goes beyond my prior understanding of how unicode developed.

BTW, did you notice from the that the little resume on the left that the
author was the "keynote speaker at ... the Cold Fusion developer
conference." ;-)

>
> It explains a lot about the variations in encoding
> but doesn't get into much detail about specific
> languages.
> In VB and VBA in a Nutshell, under Chr, it says that
> "Chr returns the character associated with an ASCII or ANSI
> character code." Chr seems to have no problem with
> unused values, like 141 through 144 in English.
> So it seems that having an internationalized version
> of Textstream binary would only require creating
> workarounds for operator characters on DBCS systems -
> recognizing when those numeric values come through
> and dealing with them accordingly.
>

Yes, but -- all string values in VB and VBS are internally stored in 2-byte
unicode, based on the page code. This creates a pitfall for non-English
128+ characters, so storage in a string (even a transitory string) needs to
be avoided. I believe that the Chr function has to create a transitory
string to hand the character back to the calling script.

> Of course it would be much easier to just use a component,
> but the ability to use Textstream for binary adds lots of
> new abilities that are then universal to WSH, rather than
> just shared between a few people.
>
>

Works for me in my local scripts. Again, however, I think that Lippert
would say that American English code pages are not "universal".

Regards,
Joe Earnest


.



Relevant Pages

  • Re: XML::LibXML UTF-8 toString() -vs- nodeValue()
    ... Wide character in print at -e line 1. ... The differences are in the encoding of the source file (UTF-8 vs. ... the string constant was converted to a character string: ...
    (comp.lang.perl.misc)
  • [TOMOYO #15 3/8] Common functions for TOMOYO Linux.
    ... This file contains common functions (e.g. policy I/O, pattern matching). ... Since TOMOYO Linux is a name based access control, ... TOMOYO Linux's string manipulation functions make reviewers feel crazy, ... the Linux kernel accepts all characters but NUL character ...
    (Linux-Kernel)
  • Re: Extra invisible characters in soap packet
    ... Converting the string to ASCII before truncating did the trick: ... "To get an accurate byte count, you need to know what encoding ... into the field data that take the field over the character limit. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: diferences between 22 and python 23
    ... string objects have the same byte ... >representation that they originally had in the source code. ... Then they must have encoding info attached? ... behind the concrete character representations there are abstract entities ...
    (comp.lang.python)
  • =?iso-8859-1?B?UmU6IFRoZSBJcmlzaCBmYWRhICjh6e3z+i/Byc3T2ikgYW5kIGVuY3J5cHRpb24vZGVjcnlwdGlvb
    ... Almost immediately I suspect a problem with encoding. ... > Public Shared Function EncryptString(ByVal AString As String) As ... better distinction between character data and byte data. ...
    (microsoft.public.dotnet.languages.vb)