09-06-2023 05:26 AM
Hello,
I am trying to display Unicode strings in Ring Controls. If I click on the right arrow to display the different items pertaining to the control it seems that Unicode=True is not taken into account. On the other hand if I select one of the items it displays correctly.
Where could the problem come from?
Thank you very much
Christophe
09-06-2023 07:21 AM
AFAIK, unicode is not officially supported. So, no bug.
09-06-2023 07:24 AM
You could try setting the ring's text "Interpret As Unicode" property to true.
09-06-2023 07:32 AM
I know Unicode is not officially supported but most functions proposed in the AddOns library work quite well including (partially) this 'Update Ring Control' 😉
I have tried your suggestion with no improvement unfortunately... 😞 the drop-down items are not Uncodely displayed while they are well displayed when one is selected...
09-06-2023 07:42 AM
That was to be expected...
I'd stop looking and try a workaround. Or maybe try Strings and Values [] just to be sure, but I'd expect the same results.
You could try a combo box or even a right click menu (catch the mouse down? event to change a left click to a right click).
A major (and limited) workaround would be to not use unicode and work with a code page set to the language you're trying to support...
09-06-2023 08:59 AM - edited 09-06-2023 09:01 AM
Use a Listbox to create your own drop-down menu if you can display Unicode in the Listbox correctly.
09-06-2023 09:36 AM
As Wiebe said, it's not technically a bug as it's an unsupported feature.
That said, it only affects characters with a integer value of less than 256 (which are mostly Latin characters). Here's a ring displaying both Latin and non-Latin character strings, and the non-Latin ones are largely OK.
What I suspect is happening is the text in the drop down is being parsed byte by byte, and as soon as a NULL (0x00) byte is found, the string is terminated. Problem is that in UTF-16LE encoding, every character value < 256 is a pair of bytes where the second byte is 0x00 (as you can see in the \ codes display of your test strings).
It is possible to render Latin looking text using homoglyph substitution, though this approach should never be used in practice for a wide variety of reasons (security, accessibility, missing glyphs in fonts, etc)
You're probably stuck with looking for an alternative to text rings. Perhaps pre-rendered unicode text in a picture ring, or showing and hiding a listbox control to act as the ring drop down selector.
09-06-2023 11:17 AM - edited 09-06-2023 11:27 AM
last time I tested (with tab controls), it was necassary to once "write" the unicode characters by copy and paste via mouse into the control or indicator.
after that, updating via property node was possible as usual.
front | block |
09-06-2023 04:52 PM
wiebe@CARYA wrote:
You could try setting the ring's text "Interpret As Unicode" property to true.
That property doesn't necessarily affect all text. It's like the font properties in that it is applied only to the selected text. Set the selection start and selection end before setting this property.
09-06-2023 05:40 PM
Here's a crazy workaround:
The Unicode characters starting at FF00.h (Halfwidth and Fullwidth Forms) are very similar to the ASCII characters starting at 0020.h. So by adding an offset of FFE0.h you will have a UTF-16 string without any null bytes; and the dropdown box works OK. See attachment.