Re: Access to document text as UTF-8
Florian Balmer <textview <at> bluewin.ch>
2004-06-01 14:46:05 GMT
Neil:
> I won't be changing the Find and Replace dialogs on Windows to use
> Unicode but I'm interested in patches from others.
I've also come across this. My first idea was to use a Scintilla control in
the Find / Replace dialog boxes, and probably use something like an
autocompletion list or similar to allow access to recent search strings.
But there's a simpler way I can suggest to you: I found out that using
DialogBoxW() instead of DialogBoxA() on NT-platforms automatically creates
the dialog controls in Unicode mode. So there could just be two different
dialog box procedures (parameters to DialogBox() functions), one for Windows
NT, which would use the W functions like GetDlgItemTextW() etc. to deal with
dialog text, and another for Windows 9x, using GetDlgItemTextA() & Co.
The W functions expect text to be Unicode, so conversion to / from Scintilla
code page is necessary. The default Windows GUI fonts used for dialog
controls can have ther limits with special Unicode characters (extended
support could be installed through the Windows setup). It's no problem to
have a call to DialogBoxW() in the executable code on Windows 9x, as long as
this function is not called and the A pendant is used (with the appropriate
dialog box procedure).
I've implemented this in my own Scintilla based project
(http://www.flos-freeware.ch/notepad2.html, sorry for the advertising,
everything is in the Edit.c source file). There's also a list to store
recent searches, which internally uses UTF-8 (with the only purpose to be
able to use the undocumented Microsoft MRU management functions exported
from Comctl32.dll, which I think don't support Unicode or NULL bytes,
(Continue reading)