How to convert binary data to text and text to binary data

I made a sample program showing how to encode a character to UTF8 and how to decode it. The program will use the Web component and the asynchronous extension hence.

UTF8.aia (24.4 KB)

The second method using java script.

convert.aia (3.6 KB)

Hello Patryk

Encode a character to UTF8 from what? App Inventor lives and breaths UTF8, so what would need to be converted to UTF8 that isn't already handled automatically?

A string of data from an external device downloaded to the application via bluetooth. The device sends a long configuration string to the application. There are both text and numeric values in this string. AppInventor only distinguishes between text and numerical data in the bluetooth component. Read / send text and read / send byte. But the device sends it all together. The decoding of everything to a readable form only takes place on the application side. The decoded information is saved in the dictionary as a key and value. The values are stored in hexadecimal form. For example, the word AppInventor is 417070496E76656E746F72. This way, the configuration is also saved to the file as a backup and sent back to the device. Someone once needed such conversion Ascii <=> Number and someone solved it by adding the string ascii to the text variable and wanting to convert ascii to a number, the positions of this character were taken. It is similar here except that not ascii but utf8.

The third and final method is extension :smiley: :

3 Likes

2 posts were split to a new topic: How do I convert a Label from Arduino to a signed number

THANK YOUUUU very much!!!!!

perfect exactly what i was looking for :ok_hand:

А с какой стороны преобразование в текст?

The methods presented here have AIA projects. You can download and test them.

1 Like