Page 1 of 1

Because PB is unicode, update UTF8() and ASCII()

Posted: Fri Jan 27, 2017 10:16 am
by Mesa
The PEEKS() function is too often used with these functions so we could simplify the code with an update of UTF8() and ASCII() like that:

*Buffer = UTF8(String$, StringUTF8$)
*Buffer = ASCII(String$, StringASCII$)


Example:
ASCII("OK", ASCII$)
Debug ASCII$

M.

Re: Because PB is unicode, update UTF8() and ASCII()

Posted: Fri Jan 27, 2017 12:17 pm
by infratec
Hi,

you have not fully understand what the procedures do.
What you want is on one side not possible and on the other it results in memory leaks.

Case 1
If you convert a normal string to ascii, you can not use debug to show it, because it is no longer in unicode.
You can check this with the memoryviewer.

Case 2
On the other side, if you have a procedure like

*Buffer = Unicode(String$, StringASCII$)

you forget to free the buffer and you have a memory leak.


Bernd