From: "Joseph J. Strout" <[EMAIL PROTECTED]>
Reply-To: Getting Started <[email protected]>
To: Getting Started <[email protected]>
Subject: RE: Ascii code question
Date: Mon, 2 Jan 2006 21:03:59 -0700
At 9:46 PM -0600 1/2/06, Dixon, Tom wrote:
You do it in code like this:
StaticText1.Text = "some special characters: " + Chr(169) + Chr(174) +
Chr(153)
Ow! No, you don't. The global Chr() function is defined for values 0
through 127 *only*. The above code is incorrect, ill-advised, improper,
and just plain a Bad Idea. Please don't use it, nor advise others to use
it.
To answer the original question... ASCII values range from 0 through 127.
Anything else is not an ASCII value, but something else. Non-ASCII
characters have different code points in different encodings. If you're
going to specify a non-ASCII character by its code point, then you must
have some encoding in mind. Don't expect REALbasic to read your mind,
though; be explicit.
For example, if it's the Windows-Latin-1 encoding that you have in mind,
when you hold the belief that 153 is the Trademark symbol (I have no idea
whether this is the case, but just suppose it for the sake of this
example), then you should use Encodings.WindowsLatin1.Chr(153). Do NOT use
just Chr(153), since 153 is not in the defined range for Chr, and if you
are unlucky the result will happen to be what you expected on your machine,
only to generate the wrong result on some other machine.
Best,
- Joe
Thanks for the clarification Joe. I was reading some and it was also
suggested on the RB Off topic list that I could probably use some platform
specific constants as I am just trying to use the ©, ®, and (copyright,
registered , and trademark symbols). The reason I ran into it is that in a
few VB projects I am converting they had used some of the symbols. Most of
the reading I have done says to use the "system font" for best results. I am
mainly concerned with what it does on a Mac.
Regards,
Dave Bert
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>