- ma jack
- PowerBuilder
- Wednesday, 13 December 2023 02:44 PM UTC
Hello everyone!
I failed when using string(blob(lb_arr), EncodingUTF8!) to convert the byte array of "?" symbol into characters.
The following is my code
// UTF-8 Encoding 0xF0 0x9F 0x89 0x82
byte lb_arr[] = {240,159,137,130}
string ls_1 = string(blob(lb_arr), EncodingUTF8!)
Messagebox("",ls_1)
The characters displayed are not the characters I want. I found in https://www.compart.com/en/unicode/U+1F242 that the UTF-16 encoding of this symbol is 0xD83C 0xDE42, so I modified my code , this code can display characters normally.
// UTF-16 Encoding 0xD83C 0xDE42
byte lb_arr[] = {216,60,222,66}
string ls_1 = string(blob(lb_arr), EncodingUTF16BE!)
Messagebox("",ls_1)
Why does the conversion fail when using EncodingUTF8? Is there any encoding range limit for UTF8 in powerbuilder?
I checked this document https://docs.appeon.com/pb2022/application_techniques/Using_Unicode.html and found no range information about UTF8.
The PB version I am using is PB2019R3 2781.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.