UCharArrayToString unicode conversion
Hello
I found that with 20.1 the function UCharArrayToString not convert correctly unicode character >127
for example character 140 is converted as � instead that [CENTER][COLOR=#212529][FONT=system-ui]Œ how it was using df19 (2017)
How can be solved that?
regards
Franco[/FONT][/COLOR][/CENTER]
Re: UCharArrayToString unicode conversion
Hi Franco,
Are you aware that DataFlex strings have become UTF-8? There is no 1-byte character 140.
ASCII is still the same, but anything >127 is two or more bytes in UTF-8. So, UCharArrayToString can lead to different results than before 20.0, but should work properly for UChar arrays that hold proper UTF-8 strings.
- André
Re: UCharArrayToString unicode conversion
Hi Franco,
Can you give some context to what you are trying to achieve? As Andre mentions, strings in DataFlex 20.x are now encoded as UTF-8 in memory by default. UCharArrayToString creates an array of bytes containing the string with its current encoding. Since characters in UTF-8 can span multiple bytes you'll see this back in that array. Note that what the debugger when displaying a UChar (array) only shows a character for the plain ASCII set and will show � for values above 127.
So the difference with DF19.x is expected, whether that is really an issue depends on what you are trying to do.
Regards,