RE: Finding the ascii code of a non-printable.



Well, I wasn't getting back any question mark (only numeric values, since
that's asc's "range"); but, Wow, thanks!--that really helped:

I got hex(ascw(”))=94 (or "\u0094"). It's a Cancel Character, "CCH", off
the C1 Controls and Latin-1 Supplement.
Awesome...thanks!!
--
HyperAnalyst


"Old Pedant" wrote:

"HyperAnalyst" wrote:

(here is a copy of the non-printable [I will put in double-quotes]:"”")
The function seems to be returning "asc(”)=63", decimal 63. Oddly enough,
the question mark on my keyboard, "?", also gives the same value, decimal 63.

Not odd, at all. The ASC( ) function will never return a value outside of
the range of 0 to 255. If the character is actually outside of that range,
it's treated as a bad translation and you get back a question mark.

Now try using
ASCW( )
where the "W" stands for "W"ide characters. That is, Unicode characters,
which are what VBS *always* uses.

But chances are good that the value you get will be 65535 (which is hex
0xFFFF) meaning that you really have a wrongly translated character, in the
first place. But maybe not.

Personally, I always use
HEX(ASCW(...))
because I find the hex easier to read and look up in various tables.




How could 2 different "characters" be transformed to the same value, through
"asc()"? Are they really different "characters"? Could this be an
indication of a VB Scripting bug?
.



Relevant Pages

  • RE: Finding the ascii code of a non-printable.
    ... the question mark on my keyboard, "?", also gives the same value, decimal 63. ... If the character is actually outside of that range, ... 0xFFFF) meaning that you really have a wrongly translated character, ... because I find the hex easier to read and look up in various tables. ...
    (microsoft.public.scripting.vbscript)
  • Re: Hyphen is being replaced by question mark
    ... Word does not register the question mark and skips right ... standard place for a hyphen in Unicode. ... character to the Clipboard, open Ctrl-H again, and press Ctrl-V to put ...
    (microsoft.public.word.docmanagement)
  • Re: OT - Happy faces
    ... face character from the Windows Character Map it comes out as a? ... My Mac does not have the frownie, so I see a question mark there. ... your newsreader is too stupid to obey the UTF-8 headers. ...
    (alt.support.diabetes)
  • Re: unsafe?????????
    ... You might try spending a little more thought on your Subject: field for your posts, so that it better describes the question you have, as well as on the actual phrasing of your question in the post. ... Also, the Typographical Conservancy phoned, and they want to know why the question mark population had a sudden decrease. ... You are assigning a string reference to a character. ... You didn't post the compiler error, but I suspect it says exactly that: something about cannot convert a string to a character. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: OT - Happy faces
    ... character from the Windows Character Map it comes out as a? ... My Mac does not have the frownie, so I see a question mark there. ... your newsreader is too stupid to obey the UTF-8 headers. ...
    (alt.support.diabetes)