|
From: Przemyslaw C. <dr...@po...> - 2014-10-07 14:23:47
|
On Tue, 07 Oct 2014, Alexander S.Kresin wrote:
Hi,
> > // set CP for source code and HVM internal string encoding
> > SET( _SET_CODEPAGE, "RU866" )
> > #ifdef __PLATFROM__LINUX
> > SET( _SET_OSCODEPAGE, "UTF8" )
> > #else
> > SET( _SET_OSCODEPAGE, "RU1251" )
> > #endif
> > In summary current Harbour versions does not force any encoding
> > regardless of used system and UI library. It's only important
> > that the libraries like HWGUI use Harbour STR API instead of
> > old Clipper like hb_parc()/hb_retc()/hb_storc()/...
> > When new API is used then all translations are made automatically
> > by HVM and user can work with anu encoding he prefers.
> Thanks for the explanation. The _SET_OSCODEPAGE was news for me.
> Which functions includes this STR API ?
In practice all string functions have corresponding ones working with
automatic translation. They are defined in src/vm/strapi.c and header
files for them is hbapistr.h:
hb_item{Get,Put,Copy}Str[Len]*(),
hb_array{Get,Sut}Str[Len]*(),
hb_parstr*(), hb_parsstr*(), hb_retstr[len]*(), hb_storstr[len]*()
In hbwinuni.h we have macros which in MS-Windows builds chose Unicode or
ANSI functions depending on UNICODE macro.
Few years ago I adopted nearly whole HWGUI code for windows to use this
macros. I do not know if it was changed later.
For *nix builds we can also use such macros, i.e. in Harbour
contrib/sddodbc/core.c such macros are defined for all builds
so they work in Windows, Linux and other systems. Probably it
would be good to move multiplatform macros from hbwinuni.h
to more generic file which can be included in all platforms.
I'll do that soon. Of course for Linux only code you can use
functions defined in hbapistr.h directly.
best regards,
Przemek
|