[fpc-devel] ansistrings and widestrings

peter green plugwash at bircd.org
Wed Jan 5 18:32:40 CET 2005


ok i see a MAJOR problem with the semantics of those functions.

they assume that one widechar is equivilent to one ansichar (that is the
source count of widechars will equal the destination count of ansichars or
the source count of widechars will equal the destination count of
ansichars).

this is simply not the case for many encodings. (utf-8 sjis euc to name just
a few)


> -----Original Message-----
> From: fpc-devel-bounces at lists.freepascal.org
> [mailto:fpc-devel-bounces at lists.freepascal.org]On Behalf Of Michael Van
> Canneyt
> Sent: 05 January 2005 16:11
> To: FPC developers' list
> Subject: RE: [fpc-devel] ansistrings and widestrings
>
>
>
>
> On Wed, 5 Jan 2005, peter green wrote:
>
> > where are theese default versions located in the code?
> >
>
> In the inc directory of the rtl. wstrings.inc
>
> procedure Wide2AnsiMove(source:pwidechar;dest:pchar;len:SizeInt);
> procedure Ansi2WideMove(source:pchar;dest:pwidechar;len:SizeInt);
>
> Michael.
> >
> > > -----Original Message-----
> > > From: fpc-devel-bounces at lists.freepascal.org
> > > [mailto:fpc-devel-bounces at lists.freepascal.org]On Behalf Of Alexey
> > > Barkovoy
> > > Sent: 05 January 2005 07:36
> > > To: FPC developers' list
> > > Subject: Re: [fpc-devel] ansistrings and widestrings
> > >
> > >
> > > > if i do ansistringvar := widestringvar or widestringvar :=
> ansistringvar
> > > > what does the compiler do?
> > > >
> > > > 1: use the systems default encoding (if so obtained from where?)
> > > > 2: use utf-8
> > > > 3: use iso-8859-1
> > > > 4: use something else?
> > > >
> > > > furthermore if the encoding used is one not capable of
> representing all
> > > > unicode code points what are the reduction rules used in the
> > > conversion from
> > > > widestring to ansistring?
> > >
> > > Compiler internally uses Wide2AnsiMoveProc and Ansi2WideMoveProc
> > > functions which
> > > can be reassigned by user. Currently their are just maping lower
> > > 128 chars in
> > > one representation to other. On Windows there are system
> > > functions that can be
> > > used to do conversion: MultiByteToWideChar and
> > > WideCharToMultiByte - these
> > > functions can take into account specified or globally set code page.
> > >
> > >
> > > _______________________________________________
> > > fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> > > http://lists.freepascal.org/mailman/listinfo/fpc-devel
> >
> >
> > _______________________________________________
> > fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> > http://lists.freepascal.org/mailman/listinfo/fpc-devel
> >
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel





More information about the fpc-devel mailing list