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

Michael Van Canneyt michael at freepascal.org
Tue Nov 27 21:22:44 CET 2007



On Tue, 27 Nov 2007, Daniël Mantione wrote:

> 
> 
> Op Tue, 27 Nov 2007, schreef Felipe Monteiro de Carvalho:
> 
> > On Nov 27, 2007 8:37 PM, Daniël Mantione <daniel.mantione at freepascal.org> wrote:
> > > A more generic solution is necessary; one can want to output strings in a
> > > specific encoding, utf-8 is only one of the specific encodings that are
> > > demanded. Therefore a boolean is not a good solution.
> > 
> > Win32Wide2Ansi just calls WideCharToMultiByte, which reading ms docs:
> > 
> > http://msdn2.microsoft.com/en-us/library/ms776420.aspx
> > 
> > I couldn't find any way to output to an arbitrary encoding. I don't
> > know if this situation is similar on linux.
> 
> This function has a code page parameter, which allows you to specify 
> the code page you want to use?
> 
> > So it may be impossible to implement what you suggest in a reasonable way.
> > 
> > Having said that I consider outputing always to an encoding which
> > isn't the current locale and isn't utf-8 a very corner use case, if it
> > has any utility at all. Being a very corner case one could use a
> > special library to achieve it.
> 
> It isn't a corner case at all. Imagine a text editor that should be able 
> to read/write in specific encodings. Or perhaps you are coding a http 
> client; documents on the web can be in any IANA approved encoding.

Indeed. I am in the designing stage for something similar for the DB 
components - they need code page remapping kind of functionality too -  
but ansistrings only, i.e. no widestring.

Michael.


More information about the fpc-devel mailing list