(UTF-8 ?) Uft-8 code manipulation

Uft-8 code manipulation

Is there a Mit AppInventor extension that can be used to obtain the uft-8 code of a character and to obtain a character corresponding to an uft-8 code?
For example, I want to create a function that :
1- gives the uft-8 code of the character "b",
2- performs an operation such as "+1" on the hexadecimal value, then
3- converts the result into a new character.

How do I do this?

No but you can use this table https://www.utf8-chartable.de/

You write Block code to do what you want based on the table mentioned. Convert the table to a dictionary and use that to develop the required code. :wink:

for b U+0062 b 62 LATIN SMALL LETTER B

I have that file in

Hello

Did you manage to solve your problem.

I need to set a Label.Text to text corresponding to a value U+1FXXX, for example.
I don't want to use a Dictionary, but I want to generate the text from the code, isn't this possible?

If I have a very simple arithmetic formula to generate it, according to my application, it is not necessary to have a big Dictionary for that.

Thanks in advance,
Osmany

I don't have such a technique available off the top of my head.

But I would start looking at Javascript for such a solution.

Do you have a sample code to try?

Thanks @ABG,

I think I'll use the dictionary for now :slight_smile: I was hoping there would be an escape character for utf-8 or something similar.

What I need is to generate the UTF-8 texts for the domino tiles, each tile is represented in my app by an ordinal, for example the tile 2-3 has the number 8 as its ordinal.

In total, there are 28 horizontal tiles and 28 vertical tiles. I wanted to avoid a Dictionary of this size.

Samples, if were possible Text(utf-8-code)
h text = Text(U+1F030 + Ordinal)
v text = Text(U+1F062 + Ordinal)

Any other ideas would be welcome,
Osmany

A dictionary of 56 items is not especially onerous for the Blocks Editor, once collapsed.

You could alternatively type up a 56 row CSV table and load it from the Media folder at startup.

Do you have a URL for this code table?

P.S. The PDF at https://www.unicode.org/charts/PDF/U1F030.pdf
has text that can be copied into a columnar text editor like Notepad++ to form such a CSV table.

dominos.aia (1.5 KB)
image

The blanks need to be removed from these text blocks, derived from vertical stripes of the above pdf.

From there you can use the segment text block to get dominoes by index.

1 Like

I´m using this

I think I'd better use two lists with the ordinals as indices shifted by one.

Thanks for your time,
Osmany

However, I think something like "Some text &#1F062" or "Some text \U+1F062" could be provided for the Text constants. Thinking out loud

Also nicely presented in Google Docs Special Characters:

image

Hover over an item to get the unicode value

In AI2 if you set a label to HTMLFormat in the designer, then a font of @ 50 and FontBold, you can do this:

image

(horizontal domino 01/02)

1 Like

By the way, my BlueStacks emulator drops the ball on typeface support.
Everything looks like an X.

Fortunately, the typeface works on my Moto G phone.

Here's the run time math version, built on the @TimAI2 technique.

My phone video was slow to upload, unfortunately.


dominos.aia (2.7 KB)

1 Like