iup-rust
iup-rust copied to clipboard
Use UTF-8 mode
IUP uses a encoding depending on the C locale, Rust is Unicode aware by the means of UTF-8. Thus the UTF-8 mode of IUP must be enabled by us right after calling IupOpen, the global attributes are UTF8MODE and UTF8MODE_FILE (docs here).
Additionally it should be clearly documented we turn UTF-8 mode ON so the user don't need to worry about it.
It looks like this is only supported in GTK and Windows. I think we could use the target_os cfg attribute to test whether the platform is a GTK or Windows platform (see Product -> Availability). Maybe there is also some way to get this information from IUP directly that I am unaware of. If the platform is not GTK or Windows, we should at least print a warning during IUP initialization.
There's a DRIVER attribute that specifies the current backend (GTK, Motif or Win32).
Though I don't see it as a major issue as Motif is supported by IUP only because Tecgraf legacy applications need it on the older platforms they run, i.e. it'll mostly like be always GTK or Win32.
The Drag&Drop system says the following:
Here are some common Drag&Drop types defined by existing applications:
- "TEXT" used for regular text without formatting. Automatically translated to CF_TEXT in Windows.
- content MIME types, like "text/uri-list", "text/html", "image/png", "image/jpeg", "image/bmp" and "image/gif".
- "UTF8_STRING" in GTK and "UNICODETEXT" in Windows.
- "COMPOUND_TEXT" in GTK and "Rich Text Format" in Windows.
- "BITMAP" and "DIB" in Windows. Automatically translated to CF_BITMAP and CF_DIB.
Not sure if we need to handle this, but needs to be checked.
UTF8MODE and UTF8MODE_FILE are now active (and gives a println warning on Motif), however this issue should not be closed yet.
- This must be documented somewhere.
- This Drag&Drop case posted above needs to be checked.
UTF-8 mode is now documented on 6e2a2bc62. Drag&Drop still needs to be checked.