PDA

Click to See Complete Forum and Search --> : Ascii codes...


oVeRRiDe
Aug 10th, 2000, 07:04 AM
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

rino_2
Aug 10th, 2000, 01:24 PM
Hi,

Would you please send me the code? I'm sure I will be able to help. My Email address: rino_2@yahoo.com

gwdash
Aug 12th, 2000, 05:36 PM
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.

Aug 12th, 2000, 07:53 PM
Sometimes the Chr function gives me some strange problems with some characters..

What kinds of problems happen?

Mad Compie
Aug 13th, 2000, 05:10 AM
OK, please send me the code to compie@idcreation.com

Sastraxi
Aug 13th, 2000, 10:08 AM
I agree with gwdash. The other characters aren't supported. So, I suggest this outputting with a UDT, like this:


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:


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

oVeRRiDe
Aug 13th, 2000, 11:29 AM
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

Mad Compie
Aug 17th, 2000, 12:37 PM
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...

Mad Compie
Aug 22nd, 2000, 12:59 PM
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.