Provide StringUtf8 fileName variant for FileNode in ANSI system
we have a large number of ANSI environments that we have a huge investment in and would be a major change to convert to Unicode. However these environments are having to handle directory and file names that contain true Unicode names which do not convert to ANSI. The FileNode property fileName is of type String and returns a meaningless name where the file name contains Chinese characters. Provision of a StringUtf8 filename would allow access of such names and handling f these
Apologies for necro.
For anyone who still has this problem, where upgrading to the Unicode edition of Jade is not feasible, Windows itself now has a feature that is useful for this case.
https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page
The way I've found to turn this on for Jade is to go to System Settings, navigate to "Time & language" > "Language & region" > "Administrative language settings", then click "Change system locale" and check the box labeled "Beta: Use Unicode UTF-8 for worldwide language support", then restart to apply it.
In Jade, this lets you enumerate files with unicode text as filenames via FileFolder::files() -> FileNode::fileName, without any extra configuration.
It displays fine in basic form controls where there is no text-edit functionality. I don't have an extensive list, but it displays as expected with labels & the write window, but terribly with textboxes and the JadeFolderBrowser (internally a listbox?).
You can also read data from these files into ANSI strings with readline or readstring, though I am not confident that Jade's sortOrder based on locale will handle this properly for the ANSI string type, so would advise against persisting the data like this without converting and storing it in the bigger StringUtf8 type unless you know what you are doing and have tested extensively.
I would also advise against only changing this setting on parts of your fleet running Jade, as this might introduce inconsistent behavior.
Most of Windows uses utf16, and Jade trims this down to the ANSI representation if you try to type it in with language pack features (In New Zealand, letters with macrons can be entered with ` + a, as an example), and sometimes when copying into/from the clipboard depending on the source.
The one way I've been able to consistently get a variety of utf8 text into Jade is by copying and pasting the text from a web browser.
I want to reiterate that the plant's recommended approach is to upgrade to the Unicode version of Jade, because they probably won't support this.
But this is a workaround that doesn't require any database conversion (bigger map files, downtime, more disk to use) or new binaries.
Cheers