[fpc-devel] Controlling the output of the widestring manager

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Tue Nov 27 20:31:06 CET 2007


Hello,

Today I took a look at what would be necessary to implement
controlling the output of the widestring manager, and implementing
this looks rather trivial.

The only thing we need is a switch, to control if widestrings should
be converted to the current locale or to utf-8. In the case of current
locale one can use the current widestring function Wide2AnsiMoveProc .
In case of utf-8 we can use the cross-platform UnicodeToUTF8 function.

I would start by adding a new field to TWideStringManager:

OutputUTF8ToStrings: Boolean;

Then when converting a widestring to a short string one should check
which procedure to call.

I could check all places that call Wide2AnsiMoveProc and instead do:

if OutputUTF8ToStrings then UnicodeToUTF8()
else Wide2AnsiMoveProc ()

Or we could add a procedure which does this automatically. Or maybe
something else.

So, which would be the prefered way?

thanks,
-- 
Felipe Monteiro de Carvalho



More information about the fpc-devel mailing list