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


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

Re: Textstream Write

From "R.Wieser" <address@not.available>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Textstream Write
Date 2019-04-30 13:21 +0200
Organization Aioe.org NNTP Server
Message-ID <qa9b3j$1766$1@gioia.aioe.org> (permalink)
References <qa6scj$rb4$1@dont-email.me> <1k7dxxu57i778$.1fqupgnjvlevy.dlg@40tude.net>

Show all headers | View raw


JJ, Mayayana,

> Interresting problem.
>
> The initial cause is because of the "Ąż" (code point 0x25BC; black
> pointing-down triangle) character which follows the "SHARE" link

With this explanation I realized I bumped into the very same when I used the 
"Microsoft.XMLHTTP" (and other, similar ones) to download a webpage and save 
the contents.

Although I could display (wscript.echo, MsgBox) the contents with no 
problems, there was no way I could write it to an UTF8 file.   The only 
solution was to write it in Windows Wide-character format.   :-(

In other words: Although the object read a multi-byte character webpage with 
no problems, it could not be saved as the same.  :-(

The "solution" I came up with was to replace all non-ASCII characters with 
HTML encodings representing their values:

function WSToHtml(sSource)
  dim sTemp,i,sChar

  sTemp=sSource
  i=1
  while i<len(sTemp)
    sChar=mid(sTemp,i,1)
    if ascw(sChar)<0 or ascw(sChar)>127 then
      sTemp=replace(sTemp,sChar,"&#x"& hex(ascw(sChar)) &";")
    end if
    i=i+1
  wend

  WSToHtml=sTemp
end function

(mind the "ascw(sChar)<0" in there)

Hope that helps.

Regards,
Rudy Wieser

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


Thread

Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-04-29 08:55 -0400
  Re: Textstream Write JJ <jj4public@vfemail.net> - 2019-04-30 17:45 +0700
    Re: Textstream Write "R.Wieser" <address@not.available> - 2019-04-30 13:21 +0200
  Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-04-30 08:51 -0400
    Re: Textstream Write "R.Wieser" <address@not.available> - 2019-04-30 18:22 +0200
      Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-04-30 13:01 -0400
        Re: Textstream Write "R.Wieser" <address@not.available> - 2019-04-30 21:37 +0200
          Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-04-30 17:06 -0400
            Re: Textstream Write "R.Wieser" <address@not.available> - 2019-05-01 10:01 +0200
              Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-05-01 08:37 -0400
                Re: Textstream Write "R.Wieser" <address@not.available> - 2019-05-01 16:00 +0200
                Re: Textstream Write "R.Wieser" <address@not.available> - 2019-05-01 16:12 +0200
                Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-05-01 10:47 -0400
                Re: Textstream Write "R.Wieser" <address@not.available> - 2019-05-01 19:09 +0200
  Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-05-04 15:26 -0400
    Re: Textstream Write JJ <jj4public@vfemail.net> - 2019-05-05 20:15 +0700
      Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-05-05 10:19 -0400

csiph-web