Results 1 to 9 of 9

Thread: Ascii codes...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Italy
    Posts
    90
    Hi everyone!
    I am gonna get crazy soon with this problem... the problem
    is the following: a program i am building gets from a
    procedure a 8-bit binary value. Let's suppose, for example,
    10010100 . Now my program has to convert this number to
    decimal, in this case 148, and then to the corresponding
    ASCII character, in this case "o with dieresis". The
    problem is that when i get characters from decimal values,
    sometimes the Chr function gives me some strange problems with some characters... This seems to happen when i
    get ASCII characters from decimal values that are lower
    than 31 or over 200... but also other characters.

    Is there anybody who wants to take a look to my program?...
    i'll send it by email...
    Thanks for the support

  2. #2
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287

    Smile Please send me the code

    Hi,

    Would you please send me the code? I'm sure I will be able to help. My Email address: [email protected]
    rino_2
    Visual Basic, HTML
    Please Visit my Site: Richard's VB Site

  3. #3
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    Some of those Characters are below the range of "Windows" so to speak. They arn't letters or such, there things like "Ctrl-x" and such. The don't show up on the screen well. I've used them only to talk to a 1960's computer over a phone line in an app i made.
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  4. #4
    Guest
    Sometimes the Chr function gives me some strange problems with some characters..
    What kinds of problems happen?


  5. #5
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    OK, please send me the code to [email protected]

  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I agree with gwdash. The other characters aren't supported. So, I suggest this outputting with a UDT, like this:

    Code:
    Type MyCode
       Decimal As Integer
       ChCode As String
       Add As Boolean
       Sub As Boolean   
    End Type
    Then, you can output your function as MyCode, and fill in Decimal(Decimal Number) but DON'T fill in the ChCode. Then, if it comes up with a code that is too high, subtract 128 from it. In this case, MyCode.Sub = True. If it's too low, Add 32 to it. In this case, MyCode.Add = True.

    The Adding will work, I'm positive (no pun intended). But i'm not so sure on the subtraction side. Keep changing it until you get no errors.

    Then, when you display the code, you must use this function to get the correct Ascii code:

    Code:
    Function RetChar(ByVal lpCode As MyCode) As String
       If lpCode.Sub = True then lpCode.Decimal = lpCode.Decimal - 128
    
       If lpCode.Add = True then lpCode.Decimal = lpCode.Decimal + 64
    
       RetChar = Chr(lpCode.Decimal)
    End Function
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Italy
    Posts
    90
    I am gonna try this way. I think this should work... i will
    post an answer as soon as possible (probably after
    holidays :-P)
    Thanks a lot to everyone

  8. #8
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Hi, I looked into your codebut did not encounter the problems as you mentioned in your email.
    When I copy the ASCII chars in the last textbox (first form) to the Windows Clipboard (Ctrl-C) and paste them in the first textbox (2nd form) the chars are displayed differently (because the structure of the Font) but the contents are the same as in the first textbox. I checked the hex values for each character and that was correct.
    But, how do you copy the contents of the mask to the 2nd Form? In your program you can't copy/paste it. And with Ctrl-C you can ONLY copy/paste ONE item at a time...

  9. #9
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    I did not try ASCII codes $0D and $0A. If these are the bytes reproducing the error, perhaps you could check for a CR/LF and encrypt an extra byte or something.
    Anyway, I will try your program with these values.

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