Asc() and Chr() functions for Unicode, UTF-8, and maybe also for the UTF-16
Adding the parameter [, Format] to those functions would be good.
Asc() and Chr() for Unicode, UTF-8
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: Asc() and Chr() for Unicode, UTF-8
Chr() and Asc() already working with Unicode.
Code: Select all
Debug Asc("€")
8364
Code: Select all
Debug Chr(8364)
UTF-8 is not necessary because a string in PureBasic can exist only as ascii or unicode€
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: Asc() and Chr() for Unicode, UTF-8
Yes ther looks like it works:
But only if compiled as unicode.
Code: Select all
For t.l=0 To 65535
If Asc(Chr(t))<>t
Debug "error"
EndIf
Next
Re: Asc() and Chr() for Unicode, UTF-8
You can use PokeS() with #PB_Ascii or #PB_Unicode flag and PeekC() afterwards to get what you want. Since PokeS() also alway writes the terminating #NUL$ this works in any case.