Thanks, I will try to take look at this. Meanwhile, I'll make this into a GitHub Issue.
If you do look at this, it's probably better to use our own wc to utf conversion functions, from the fl_utf8 stuff, than to pull in external functions to do the job... Not sure all the compilers like that ..
I never really understood Microsoft's winmain approach, never really "got" it...
Matt,
If you do look at this, it's probably better to use our own wc to utf conversion functions, from the fl_utf8 stuff, than to pull in external functions to do the job... Not sure all the compilers like that ..
WideCharToMultiByte()
and MultiByteToWideChar() already
in src/Fl_Native_File_Chooser_WIN32.cxx
and src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx"
(see GitHub issue #840,
https://github.com/fltk/fltk/issues/840#issuecomment-1817928735).WideCharToMultiByte() in this context.
This should be available on all our supported platforms and has
already been used for a while...WideCharToMultiByte()
if it is available on all versions of MSWindows. It would replace a
whole page of handmade code."
Regarding our own "Wide Character to UTF-8" functions for Windows: we have several and I still need to investigate details.
I discovered: "we're using WideCharToMultiByte() and MultiByteToWideChar() already in src/Fl_Native_File_Chooser_WIN32.cxx and src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx" (see GitHub issue #840, https://github.com/fltk/fltk/issues/840#issuecomment-1817928735).
Since this a Windows-only issue and this specific function (i.e. WinMain() calling main()) is *only* for Visual Studio (!) I decided to use WideCharToMultiByte() in this context. This should be available on all our supported platforms and has already been used for a while...
I'm not sure what the best solution would be. As Matt wrote: "It sure makes sense to use WideCharToMultiByte() if it is available on all versions of MSWindows. It would replace a whole page of handmade code."
Since we're using it already in FLTK 1.3 it should be safe to use it for all our conversions on the Windows platform.
Is there a reason to believe that "our version" could be faster or better than the MS version?
What do you and others think?
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/9071e549-26a9-4041-b7bc-baf466b06568n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/6f7ee419-b3e2-4c79-999f-dc043a3b97c6%40online.de.
On 11/23/23 10:32, Bill Spitzak wrote:
Though I like converting errors into CP1252 (as it makes old strings still work), it is not vital. What is vital is that the functions don't do anything other than return all the valid characters in the string if there is an encoding error in the middle, and replaces the errors with something that is a valid encoding.
FWIW in Fl_Terminal I've been using the "upside down question
mark" for errors, e.g.
const char *unknown = "¿";
That's seems to be a popular character in spanish, and is in
the CP-1252 set.
I think old IBM terminals I used did the same thing for
unprintable characters.
I use it for showing bad ANSI/xterm sequences and
unprintable/unsupported
control characters.
The Fl_Terminal::show_unknown(true|false) method
turns that feature on or off.
When it's off, it shows nothing instead of that
character.