[fpc-pascal] Unicodestrings and Assign(File)

Jürgen Hestermann juergen.hestermann at gmx.de
Sat May 12 11:31:03 CEST 2012


Noah Silva schrieb:
 > Thus, the only question would be whether you have to manually convert 
a UnicodeString to a UTF8String or not.

No, that would not help. Under Windows you can access long paths *only* 
when using special functions (i.e. FindFirstFileW instead of 
FindFirstFileA). And these functions need unicode (widechar) paths 
strings with a prepended '\\?\'. There is no other way to access long 
paths under Windows. Simply converting Unicode to ANSI may let me use 
most (but not all) Unicode characters but the paths would always be 
restricted to MaxPath (about 260) characters. Only when using API 
functions ending with a W I can access longer paths (up to 32000 
characters) and these string *must* be Unicode (widechar). So the RTL 
needs to be rewritten to allow Unicode paths handed over without 
conversion and then use Windows API functions with the W at the end.

Because this is not the case (yet), I was wondering, whether it is 
possible to use other Windows API functions like CreateFileW and then 
somehow connect them to RTL file data structures so that I can replace 
"assign" and "reset/rewrite" by Windows API functions and then be able 
to use "readln" on such (text) files.

 > Still, fixing Assign/Reset/Rewrite would be better than using Unix 
calls, because you could submit a patch to save everyone else trouble in 
the future.

Yes, I would like to but neither time nor knowledge allows me to do that 
currently.





More information about the fpc-pascal mailing list