Change Log for the latest
XYplorer BETA version:
Code: Select all
v26.80.0408 - 2025-02-08 13:10
! SC asc: Had some bugs and limitations that strangely went undetected for many years.
- Definition in Help: "Returns the ASCII value of a character."
Since the function always supported 2-byte Unicode characters, the definition
should rather be: "Returns the Unicode codepoint of a character."
The name "asc" is retained for backward compatibility.
- A large range of characters returned negative numbers, although the return is
defined as "ASCII value, range 0-65535 (0xFFFF)".
For example:
echo asc("龍"); //-24691 -> should be 40845
This is fixed now.
BTW, the complementary function chr() surprisingly tolerates the signed version of
the codepoint:
echo chr(40845); //龍
echo chr(-24691); //龍
- The function now also supports 4-byte Unicode characters, aka surrogate pairs.
The return is now defined as "codepoint, range 0-1114111 (0x10FFFF)".
echo asc("𝕿"); //120191
+ SC asc: Added a parameter to format the return value.
Syntax: asc(string, [format])
format:
missing: Return decimal value.
H: Return raw hex value.
X: Return prefixed hex value (eg 0x9F8D).
U: Return Unicode Number (eg U+9F8D).
B: Return hex values of bytes (Little Endian) instead of codepoint.
Makes a difference only with surrogate pairs.
A: Enforce ANSI code page.
Examples:
echo asc("𝕿"); //120191
echo asc("𝕿", H); //1D57F
echo asc("𝕿", U); //U+1D57F
echo asc("𝕿", B); //DD7FD835
echo asc("€"); //8364
echo asc("€", X); //0x20AC
echo asc("€", A); //128 (might differ depending on locale)
// chr() and asc() complement each other:
echo chr(asc("龍")); //龍
echo chr(eval("0x".asc("龍", H))); //龍
echo chr(asc("𝕿")); //𝕿
echo chr(eval("0x".asc("𝕿", H))); //𝕿
echo asc(chr(40845)); //40845
echo asc(chr(0x9F8D), X); //0x9F8D
echo asc(chr(0x1D57F), X); //0x1D57F

To easily
upgrade to this BETA version from XYplorer, hold down the
CTRL key while you click
Help | Online Support | Check for Updates. If you prefer to
download the BETA version, choose one of these packages:
(1)
Installer Package, (2)
No-Install Package (for manual unpacking).
Note that BETA versions are work in progress and may contain new bugs. You have been warned. It's a good idea to backup your complete XYplorer settings (File | Settings Special | Backup Application Data Folder...) before running a new BETA. This will also help to fix any new bugs.