On Wed, 09 Sep 2009, Alexandr Okhotnikov wrote:

Hi,

> Function working with files a lot (several dozen) and each must write
> a wrapper, given codepage each platform and each locale? Nuance:

No, you haven't.
You wrote that you cannot open existing files with national
characters what is not true and I sent the example to illustrate it.

> passing a string (UTF8) in the function (eg, strfile ()), we may face
> a situation where the called function (do not understand UTF8)
> incorrectly processes the string.

Exactly. But the same we can say about using UTF8 in file names at all.
Some 3-rd part programs may not understand it correctly, i.e. it creates
very serious problems when you have to share the same files using SMB
volumes with MS-Windows stations.
Any arbitrary translations to UTF8 or locale is very bad idea.
It has to be programmer choice otherwise it may cause more troubles
then help and create situations when Harbour really will not be able
to open existing files.

I know that you are asking about automatic UTF8<->HVM-CP conversions
and of course as an option it's interesting solution though it does
not resolve the problem in many cases, i.e. it will not enable any
automatic translations in 3-rd party libraries linked with Harbour
application but it can work only for our own code which operates
on file system names so your above problem will still exists in
applications using some 3-rd party extensions. Such translation
will block opening files which are not valid UTF8 names or cannot
be translated to HVM CP. It also does not resolve the problem with
source code using UTF8 encoding. In fact we should have support for
CP translation also in compiler so programmer can define encoding
in source code as one of compile time switches.

Now I do not have time and enough motivation to rewrite our CP code
so if no one else does it then we will have to leave with it yet but
I'll add hack with pseudo codepage called "UTF8" which can be used
only for translations so you can set it as _SET_OSCODEPAGE.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to