|
-
Aug 15th, 2004, 02:10 PM
#1
Thread Starter
Frenzied Member
Which ASCII Extended? (Resolved)
I searched for the ASCII Extended Table and to my surprise I found two different tables...
In one of them it begins with "€" and the other one begins with "Ç"... I tried running in my VB the following code:
VB Code:
Dim i As Long
For i = 128 To 255
Debug.Print "Ascii(" & i & ") = " & Chr(i)
Next i
And in 128 I got "€", but is it safe to assume all computers will have Chr(128) = "€"?
Last edited by Tec-Nico; Oct 3rd, 2004 at 01:49 PM.
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
Aug 15th, 2004, 04:10 PM
#2
How the ASCII value looks on screen or paper is a matter of FONT.
-
Aug 15th, 2004, 06:47 PM
#3
Thread Starter
Frenzied Member
Are you sure? Then why is 97 always "a" no matter what?
The same should be valid for "á" and it is not...
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
Aug 15th, 2004, 06:50 PM
#4
Originally posted by Tec-Nico
Are you sure? Then why is 97 always "a" no matter what?
The same should be valid for "á" and it is not...
The first 128 have been pretty standard for 50+ years.
What happens above 128 is up for grabs.
97 = "a" is euro-centric - and we American's followed along...
-
Aug 15th, 2004, 06:58 PM
#5
Thread Starter
Frenzied Member
So you tell me that above 127 there is no way to know which will be the symbol they represent?
Then how do compilers know when you are using a proper variable name and when you are not?
I mean, I would believe it if I couldn't do this:
VB Code:
Option Explicit
Private Sub Form_Load()
Dim myVáríáblê As String
myVáríáblê = "a"
Debug.Print Asc(myVáríáblê)
End Sub
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
Aug 16th, 2004, 04:03 AM
#6
You can know what character they are, as long as you know what font they are in.
Bear in mind that computers dont "see" characters like we do, to a computer they are just numbers (the ascii codes). Compilers just have limits as to which characters are allowed, for VB it must start with an alphabetic character, followed by pretty much any other printable characters.
I think that the Euro symbol (€) is supposed to always be char 128, as long as the font supports it (which is all standard fonts if the OS has had an update - I think Windows 95/98 both needed a patch).
-
Aug 16th, 2004, 09:40 AM
#7
Thread Starter
Frenzied Member
So... Let me see... If I have always the same font there won't be any problem?
Lets think I have a RichTextBox with "MS Sans Serif" in which I will type something like a program, for example:
VB Code:
Dim strVariablê As String
strVariablê = "hello world"
Debug.Print strVariablê
And then I get all that Text into a Variable (In VB), strProgram, which is a String, and I start looping through the String checking for the Ascii of the Letters:
VB Code:
Dim i As Long
For i = 1 to Len(strProgram)
Debug.Print Asc(Mid(strProgram, i, 1))
Next i
Will I always get the same printed in the Immediate no matter the computer my code is running on?
And thus, can I safely assume I will always get ê to be 234?
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
Aug 16th, 2004, 09:51 AM
#8
Assuming that both computers have the up-to-date fonts installed (Windows 2000+ should be fine), you will get the same text on both machines.
-
Aug 16th, 2004, 11:12 AM
#9
Thread Starter
Frenzied Member
Thank you very much. Just one more question... Would that apply to Win95 and Win98 too?
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
Aug 16th, 2004, 11:17 AM
#10
As long as they have the font updates, but I'm afraid I don't know which Windows versions/service packs it applies to. As far as I am aware it is only the Euro symbol that has changed from previous versions. The best bet would be to check MSDN.
A quick test is to open notepad and pres AltGr and 4, it should put the Euro symbol in.
-
Aug 16th, 2004, 07:40 PM
#11
Thread Starter
Frenzied Member
Thank you once again.
This will be my last question about this, I promise...
Lets say I save my file like this:
€ ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’ “ ” • – — ˜ ™ š › œ ž Ÿ _ ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ _ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
1 2 3 4 0 ...
And then I check the first line of the string to check "€" against Chr(128)... Will my file really have "€" in it or will the € will turn into something else in case the extended ASCII in the machine is different?
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
Aug 16th, 2004, 07:52 PM
#12
As said before, it doesn't matter for the computer what the character value is. All computer sees is a binary represeting us a value 128. Thus, if you opened the file in a different computer with different extended ASCII, or with a font with different extended ASCII (such as Terminal), you'd see something else than the euro character. But the character number would still be the same, even if the way of displaying it changes. There is no way of skipping this problem, if you start thinking about it as one. Except to use Unicode, Unicode fonts and Unicode systems, which MUST use the same standard on all systems.
-
Aug 16th, 2004, 08:23 PM
#13
Originally posted by szlamany
How the ASCII value looks on screen or paper is a matter of FONT.
You really need to fully grasp this - display has nothing to do with what the ASCII character is or what it looks like...
FONT tables allow any ASCII value (even 1 to 128) to look different than a "display" you are familiar with.
The beautiful part of this is that you can actually define the "bit look" (icon-like) display of any value - 128 or 1, 2, 3...
If it looks like "garbage" it will still have the same ASCII value - the look is a matter of FONT - and that is eye-candy...
-
Aug 16th, 2004, 09:47 PM
#14
Thread Starter
Frenzied Member
Thank you Merri and szlamany. I was afraid that would happen... I just needed to confirm what I thought.
Thank you, anyway. I guess I will limit it to the first 128 characters (from 0 to 127) so the user can select from them.
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|