Error in character representation in a string

Moderator: Benj

User avatar
tiny
Posts: 180
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 49 times
Been thanked: 76 times
Contact:

Error in character representation in a string

Postby tiny » Fri Sep 13, 2019 3:24 pm

I'm using FC8 last update on Windows 10, 1903.

If ASCII characters smaller than 32 or greater 126 are contained in a string, these are represented as hex numbers.
For normal programming, certainly no or only a small problem, but I would like to program an encryption tool and
because it may very well come to special characters in the key and the decryption is then a serious error.
This tool is a Vernam encryption that works very well under VB.
Now I want to port this tool to FC8 in order to transmit sensitive data encrypted.

Example of error: "Begründung" becomes "Begr\xfcndung" in the string.

Can someone please look at that?
Thanks
Christina

User avatar
Benj
Matrix Staff
Posts: 14216
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4355 times
Been thanked: 4095 times
Contact:

Re: Error in character representation in a string

Postby Benj » Fri Sep 13, 2019 5:24 pm

Hi Christina,

If the encrypted string contains NUILL characters then you may need to use a byte array instead of a string, a NULL would effectively mark the end of the string.

Otherwise a string should do exactly what you need it to. The print as hex is likely just done by the console or whatever you are using to see the data as the ASCII character may not be printable.
These users thanked the author Benj for the post:
tiny (Fri Sep 13, 2019 9:21 pm)
Rating: 5.26%
 

User avatar
tiny
Posts: 180
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 49 times
Been thanked: 76 times
Contact:

Re: Error in character representation in a string

Postby tiny » Fri Sep 13, 2019 9:21 pm

Hello Ben,
I found this mismatch in the simulation, so I'm going to test that routine inside the MCU.

Many thanks
Christina