Re: [fpc-pascal] Help making code unicode capable

2007-11-10 Thread Marc Weustink
Mattias Gaertner wrote: On Sat, 10 Nov 2007 15:44:54 +0100 "Felipe Monteiro de Carvalho" <[EMAIL PROTECTED]> wrote: Thanks, I arrived at this: var FilterBuffer: WideString; ... FilterBuffer := Utf8Decode(Filter); lpStrFilter := GetMem(Length(FilterBuffer) * 2 + 2); Move(Fi

Re: [fpc-pascal] Help making code unicode capable

2007-11-10 Thread Marc Weustink
Felipe Monteiro de Carvalho wrote: Hello, I have a small piece of code on LCL which I have found hard to convert to unicode: lpStrFilter := StrAlloc(Length(Filter)+1); StrPCopy(lpStrFilter, Filter); There is a big chance that this is an inheritence of the pre 1.0 fpc times. At th

Re: [fpc-pascal] Help making code unicode capable

2007-11-10 Thread Felipe Monteiro de Carvalho
On Nov 10, 2007 3:54 PM, Mattias Gaertner <[EMAIL PROTECTED]> wrote: >Move(FilterBuffer[0], lpStrFilter^, Length(FilterBuffer) * 2 + > 2); The compiler wisely doesn't allow accessing [0], but: Move(FilterBuffer[1], lpStrFilter^, Length(FilterBuffer) * 2 + 2); Seams to work perfectl

Re: [fpc-pascal] Help making code unicode capable

2007-11-10 Thread Mattias Gaertner
On Sat, 10 Nov 2007 15:44:54 +0100 "Felipe Monteiro de Carvalho" <[EMAIL PROTECTED]> wrote: > Thanks, I arrived at this: > > var > FilterBuffer: WideString; > ... > > FilterBuffer := Utf8Decode(Filter); > lpStrFilter := GetMem(Length(FilterBuffer) * 2 + 2); > Move(FilterBuffe

Re: [fpc-pascal] Help making code unicode capable

2007-11-10 Thread Felipe Monteiro de Carvalho
Thanks, I arrived at this: var FilterBuffer: WideString; ... FilterBuffer := Utf8Decode(Filter); lpStrFilter := GetMem(Length(FilterBuffer) * 2 + 2); Move(FilterBuffer, lpStrFilter, Length(FilterBuffer) * 2 + 2); But now it crashes when loading the dialog =/ any ideas? than

Re: [fpc-pascal] Help making code unicode capable

2007-11-10 Thread Jonas Maebe
On 10 Nov 2007, at 15:24, Felipe Monteiro de Carvalho wrote: utf8decode returns string I assume? It returns WideString. Is there a function to manually alloc a widestring like StrAlloc? Assign it to a variable of the type widestring. If you cannot this variable in scope the whole time, yo

Re: [fpc-pascal] Help making code unicode capable

2007-11-10 Thread Felipe Monteiro de Carvalho
> utf8decode returns string I assume? It returns WideString. Is there a function to manually alloc a widestring like StrAlloc? -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailma

Re: [fpc-pascal] Help making code unicode capable

2007-11-10 Thread Marco van de Voort
> On 10 Nov 2007, at 15:08, Felipe Monteiro de Carvalho wrote: > > > Having a win9x version is trivial, but having a version where we put a > > PWideChar into lpStrFilter looks hard... > > > > lpStrFilter := StrAlloc(Length(Filter)+1); > > StrPCopy(lpStrFilter, Utf8ToAnsi(Filter)); > > >

Re: [fpc-pascal] Help making code unicode capable

2007-11-10 Thread Jonas Maebe
On 10 Nov 2007, at 15:08, Felipe Monteiro de Carvalho wrote: Having a win9x version is trivial, but having a version where we put a PWideChar into lpStrFilter looks hard... lpStrFilter := StrAlloc(Length(Filter)+1); StrPCopy(lpStrFilter, Utf8ToAnsi(Filter)); I tryed this as unicode