Results 1 to 14 of 14

Thread: Which ASCII Extended? (Resolved)

  1. #1

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192

    Resolved 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:
    1. Dim i As Long
    2.  
    3.  For i = 128 To 255
    4.   Debug.Print "Ascii(" & i & ") = " & Chr(i)
    5.  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

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    How the ASCII value looks on screen or paper is a matter of FONT.

  3. #3

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    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

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    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...

  5. #5

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    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:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.  Dim myVáríáblê As String
    5.  
    6.  myVáríáblê = "a"
    7.  Debug.Print Asc(myVáríáblê)
    8. 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

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    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).

  7. #7

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    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:
    1. Dim strVariablê As String
    2.  
    3. strVariablê = "hello world"
    4. 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:
    1. Dim i As Long
    2.  
    3. For i = 1 to Len(strProgram)
    4.  Debug.Print Asc(Mid(strProgram, i, 1))
    5. 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

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    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.

  9. #9

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    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

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    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.

  11. #11

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    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

  12. #12
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    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.

  13. #13
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    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...

  14. #14

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    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
  •  



Click Here to Expand Forum to Full Width