utf8 and utf8 codepoint question

28 views
Skip to first unread message

Kovács Attila

unread,
May 15, 2022, 4:16:16 AM5/15/22
to The Ring Programming Language

HI !

I'm new here but I have a problem right at the beginning with the utf8

example :

x="őlma"

see len(x)

see x[1]

result :

alma

5


How can i get the the number of codepoints :?    4

and the first character ? ő

How can i iterate the string ?


Thank you in advance Attila




Ilir

unread,
May 15, 2022, 4:55:23 AM5/15/22
to The Ring Programming Language
Hello Attila,

UTF-8 is a specific scheme for mapping a sequence of 1-4 bytes to a number

as seen in

ring/samples/General/Hex2UTF8

If you are using Qt, look for QString class, fromUtf8 and toUtf8 methods

Kovács Attila

unread,
May 15, 2022, 5:03:10 AM5/15/22
to The Ring Programming Language
Thanks Ilir !
I'll try them.
Attila

Mahmoud Fayed

unread,
May 15, 2022, 5:03:16 AM5/15/22
to The Ring Programming Language
Hello Attila

As Ilir said, Check the QString class


Greetings,
Mahmoud

Kovács Attila

unread,
May 15, 2022, 5:19:17 AM5/15/22
to The Ring Programming Language
OK
I have tried QT
work well.
Thanks

Mansour Ayouni

unread,
May 15, 2022, 7:21:42 AM5/15/22
to Mahmoud Fayed, The Ring Programming Language
Hello Attila:

You can also also use SoftanzaLib like this;
load "stzlib.ring"
o1 = new StzString("őlma")
? o1.NumberOfChars() #--> 4
? o1[1] #--> "ő"

To install the library enter this line in the console:
ringpm install softanzalib from mayouni

PS: Please note that Softanza is in beta now.
Best,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ring-lang/c2590065-8707-4880-9b0d-f3a6852b953cn%40googlegroups.com.

Mahmoud Fayed

unread,
May 16, 2022, 9:52:59 PM5/16/22
to The Ring Programming Language
Hello Attila

>> "I have tried QT ... work well ...  Thanks"

You are welcome :D

Greetings,
Mahmoud
Reply all
Reply to author
Forward
0 new messages