Page 1 of 1
problems creating UNICODE directories
Posted:
Tue May 03, 2016 8:28 am
by marzio
i want to create directories with unicode characters, but none of the functions tried works well.
lMkDir(), MakeDir() fwh1507, bcc7, xHarbour 1.2.3 bcc7_20150603
DLL32 Function apiCreateDir(lpPathName AS STRING, lpSecurityAttributes AS LPSTR) AS LONG PASCAL FROM "CreateDirectoryW" LIB "kernel32.dll"
apiCreateDir("c:\Dir ∞ Dir") creates a directory with chinese character in the directory of exe file instead of "c:\Dir ∞ Dir" with infinite symbol.
CreateDirectoryW of kernel32.dll is declared like unicode version.
any suggestion?
marzio
Re: problems creating UNICODE directories
Posted:
Tue May 03, 2016 11:42 am
by nageswaragunupudi
With Harbour (but not with xHarbour)
- Code: Select all Expand view
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )
Worked for me.
We shall now enhance FW functions to work with Unicode names
Re: problems creating UNICODE directories
Posted:
Tue May 03, 2016 12:42 pm
by nageswaragunupudi
You can use these functions to create unicode folders.
Works with Harbour and xHarbour
- Code: Select all Expand view
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
LPWSTR fw_parWide( int iParam ); // source: msgsapi.c
HB_FUNC( LMKDIRW )
{
BOOL bRet;
LPWSTR pW;
pW = fw_parWide( 1 );
bRet = CreateDirectoryW( pW, 0 );
hb_xfree( ( void * ) pW );
hb_retl( bRet );
}
#include <shlobj.h>
HB_FUNC (LMKFULLPATHW)
{
BOOL bRet;
LPWSTR pW;
pW = fw_parWide( 1 );
bRet = ( SHCreateDirectoryExW( NULL, pW, NULL ) == 0 );
hb_xfree( ( void * ) pW );
hb_retl( bRet );
}
#pragma ENDDUMP
lMkDirW() for relative path
lMkFullPathW() for full path
You need any FWH version during 2016
Re: problems creating UNICODE directories
Posted:
Wed May 04, 2016 7:39 am
by marzio
many thanks for your reply!
i have tried:
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )
but it doesn't work.
for the second soution that require fw_parWide() i shall update to fwh 2016 version.
thanks, marzio
Re: problems creating UNICODE directories
Posted:
Wed May 04, 2016 7:53 am
by nageswaragunupudi
i have tried:
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )
As I said, this work only with Harbour. Not with xHarbour.
Even normal DIRECTORY() function works with Unicode names in Harbour but not with xHarbour.
If you plan to use Unicode, it is worth considering upgrading FWH.
After reading your post, we are planning to enhance FWH's directory functions to work with Unicode names.
Re: problems creating UNICODE directories
Posted:
Wed May 04, 2016 5:44 pm
by richard-service
nageswaragunupudi wrote:i have tried:
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )
As I said, this work only with Harbour. Not with xHarbour.
Even normal DIRECTORY() function works with Unicode names in Harbour but not with xHarbour.
If you plan to use Unicode, it is worth considering upgrading FWH.
After reading your post, we are planning to enhance FWH's directory functions to work with Unicode names.
How about it support xHarbour? I'm use xHarbour now.
Re: problems creating UNICODE directories
Posted:
Thu May 05, 2016 9:00 am
by marzio
i have tried:
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )
with harbour 3.0.0, borland c++7 without fivewin
but i obtain a directory like this: తెలà±à°—à±
what is wrong?
thanks.
Re: problems creating UNICODE directories
Posted:
Thu May 05, 2016 9:01 am
by nageswaragunupudi
You can view the folder name correctly with FileExplorer and also with Harbour's DIRECTORY() function. Not xHarbour
Re: problems creating UNICODE directories
Posted:
Thu May 05, 2016 9:14 am
by marzio
i see the wrong directory with file Explorer and with total commander.
Re: problems creating UNICODE directories
Posted:
Thu May 05, 2016 9:39 am
by nageswaragunupudi
To start with, I have a directory c:\fwh\test, which is empty.
Now I ran this program, built with Harbour and FWH
- Code: Select all Expand view
#include "fivewin.ch"
function Main()
FW_SetUnicode( .t. )
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "c:\fwh\test\" + "తెలుగు" )
XBROWSER DIRECTORY( "c:\fwh\test\*.*", 'D' )
return nil
Result:
You can see the unicode name in the xbrowse (3rd row)
Screen shot from my File Explorer
You can not expect TotalCommander to display Unicode names.
Re: problems creating UNICODE directories
Posted:
Thu May 05, 2016 9:55 am
by marzio
can you try your example without fiwewin?
i can confirm you that total commander visualizes correctly files and directories in unicode format.
Re: problems creating UNICODE directories
Posted:
Fri May 06, 2016 7:46 am
by marzio
i have inserted FW_SetUnicode( .T. ) supported by fwh1507 but i have linking error:
Error: Unresolved external '_HB_FUN_HB_BLEN' referenced from T:\MARZIO\WINCLIP\FWH1507\LIB\FIVEH.LIB|OLEFUNCS
Error: Unresolved external '_hb_extIsNil' referenced from T:\MARZIO\WINCLIP\FWH1507\LIB\FIVEHC.LIB|RICHEDIT
Error: Unresolved external '_HB_FUN___OLEVARIANTNEW' referenced from T:\MARZIO\WINCLIP\FWH1507\LIB\FIVEH.LIB|ADOFUNCS
Error: Unable to perform link
the library hbwin is linked.
which library is missing?
echo %bcdir%\lib\c0w32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.exe, + >> b32.bc
echo %1.map, + >> b32.bc
echo %fwh%\lib\FiveH.lib + >> b32.bc
echo %fwh%\lib\FiveHC.lib + >> b32.bc
echo %fwh%\lib\libmysql.lib + >> b32.bc
echo %fwh%\lib\dolphin.lib + >> b32.bc
echo %hdirl%\hbwin.lib + >> b32.bc
echo %hdirl%\gtgui.lib + >> b32.bc
echo %hdirl%\gtwin.lib + >> b32.bc
echo %hdirl%\hbrtl.lib + >> b32.bc
echo %hdirl%\hbvm.lib + >> b32.bc
echo %hdirl%\hblang.lib + >> b32.bc
echo %hdirl%\hbmacro.lib + >> b32.bc
echo %hdirl%\hbrdd.lib + >> b32.bc
echo %hdirl%\rddntx.lib + >> b32.bc
echo %hdirl%\rddcdx.lib + >> b32.bc
echo %hdirl%\rddfpt.lib + >> b32.bc
echo %hdirl%\hbsix.lib + >> b32.bc
echo %hdirl%\hbdebug.lib + >> b32.bc
echo %hdirl%\hbcommon.lib + >> b32.bc
echo %hdirl%\hbpp.lib + >> b32.bc
echo %hdirl%\hbcpage.lib + >> b32.bc
echo %hdirl%\hbcplr.lib + >> b32.bc
echo %hdirl%\hbct.lib + >> b32.bc
echo %hdirl%\hbpcre.lib + >> b32.bc
echo %hdirl%\xhb.lib + >> b32.bc
echo %hdirl%\hbziparc.lib + >> b32.bc
echo %hdirl%\hbmzip.lib + >> b32.bc
echo %hdirl%\hbzlib.lib + >> b32.bc
echo %hdirl%\minizip.lib + >> b32.bc
echo %hdirl%\png.lib + >> b32.bc
echo %hdirl%\hbusrrdd.lib + >> b32.bc
echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\uuid.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\ws2_32.lib + >> b32.bc
echo %bcdir%\lib\psdk\odbc32.lib + >> b32.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\iphlpapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\msimg32.lib + >> b32.bc
echo %bcdir%\lib\psdk\psapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\rasapi32.lib + >> b32.bc
echo %bcdir%\lib\psdk\gdiplus.lib + >> b32.bc
echo %bcdir%\lib\psdk\shell32.lib, >> b32.bc
IF EXIST %1.res echo %1.res >> b32.bc
if %GT% == gtwin %bcdir%\bin\ilink32 -Gn -Tpe -s @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
if %GT% == gtgui %bcdir%\bin\ilink32 -Gn -aa -Tpe -s @b32.bc
Re: problems creating UNICODE directories
Posted:
Fri May 06, 2016 3:02 pm
by nageswaragunupudi
We provided Unicode support from 15.09 onwards.
How about it support xHarbour? I'm use xHarbour now.
We keep extending support for Unicode in FWH dir functions. But for full implementation Harbour is a better choice.
In FWH 16.04 new functions lIsDirW(), lMkDirW(), FileW(), lRmDirW(), lChDirW() provide Unicode support.
In my view it is a good idea to maintain file-system in English and handle data/contents in Unicode.
Re: problems creating UNICODE directories
Posted:
Wed May 11, 2016 7:56 am
by marzio
i have resolved substituting Harbour 3.0 with Harbour 3.2
Now the creation of the directories with unicode characters works fine!!
(hb3.2, fwh1507, bcc7)
thanks.