I managed to get it working with: {$ifdef WindowsUnicodeSupport} if UnicodeEnabledOS then begin FileNameWide := UTF8Decode(FileName);
FillChar(FileNameWideBuffer^, FileNameBufferLen * 2 + 2, #0); if Length(FileNameWide) > FileNameBufferLen then FileNameBufferSize := FileNameBufferLen else FileNameBufferSize := Length(FileNameWide); Move(FileNameWide[1], FileNameWideBuffer^, FileNameBufferSize * 2); end else StrLCopy(FileNameBuffer, PChar(UTF8ToAnsi(FileName)), FileNameBufferLen); {$else} StrLCopy(FileNameBuffer, PChar(FileName), FileNameBufferLen); {$endif} But still, the code would be much simpler and shorter if there were PWideChar routines -- Felipe Monteiro de Carvalho _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal