You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had troubleshooted into the issue and found that the point was mb_str_split funtion which is a built-in function after PHP-7.4.
The Chinese character "哈" with UTF-8 format will be split into a Character-Array as ['哈'] by mb_str_split.
However, the same Chinese character will be split into a Byte-Array as [229, 147, 136] by str_split, which is expected in src/Encoding/Base62x::encode.
We have not figured out why the author of this repo changed the function from str_split to mb_str_split.
My advice is to use str_split for byte-array, mb_str_split for character-array.
Byte is equivalent to character in ASCII, so American-European may have no sense of such issues.
In fact, one character may contains one byte, two bytes, three bytes or even more with UTF-8 charset.
The suggestion is to replace mb_str_split with str_split in src/Encoding/Base62x for test.
Use JavaScript: Base62x.encode('哈')
output: 'vPE8'
But,
Use PHP: Base62x::encode('哈')->get();
output: 'vU5'
Hope to get your help, thanks
The text was updated successfully, but these errors were encountered: