[fpc-pascal] Unicodestrings and Assign(File)

Noah Silva shiruba at galapagossoftware.com
Fri May 11 08:20:28 CEST 2012


Hi,

According to what I have read (and I always wonder how up to date
documentation is with respect to the state of the compiler and libraries),
all standard library functions (Which would include system.assign) are
still using the "local" encoding.  For Mac OS X, luckily, this means UTF8.

Thus, the only question would be whether you have to manually convert a
UnicodeString to a UTF8String or not.

If you don't trust it, you can build an overload version of assign to
convert the string and call the old one, but note that in Windows the local
encoding will be different than UTF8 in many cases (hence the wide version
of the calls will be better), and in Linux it may be UTF-8 or something
else) - so you can't always convert UTF16 to UTF8, call the old functions,
and expect it to work on all OSs.

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.

This kind of stuff is a real pain all the time, and not even that hard to
fix, I am not sure why the "issues" remain - but perhaps there aren't
enough volunteers with enough time to work on it.

I have done a lot of Unicode work, so if you have other problems let me
know, I may already have written code to handle whatever the issue is, and
would be happy to share it.

Thank you,
     Noah Silva

2012/5/10 Jürgen Hestermann <juergen.hestermann at gmx.de>

> Is it (already) possible to use Unicodestrings for file paths?
> I was able to access long paths (with many hundreds of characters)
> in the windows API functions FindFirstFileW (with Win32_Find_DataW
> data type) but I failed to open such files with Assign(File)/reset.
> Are they converted to (one byte) Ansistring internally?
> Am I forced to use CreateFile or similar function to open such files?
>
> ______________________________**_________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120511/290e2e04/attachment.html>


More information about the fpc-pascal mailing list