Page 1 of 1
Bug? cGetDir() on utf8
Posted: Thu Apr 16, 2020 2:57 pm
by ssbbs
Code: Select all
HB_SetCodePage("UTF8")
HB_CDPSELECT("UTF8")
//
FW_SetUnicode(.T.)
cIniDir:="c:/temp/中文目錄"
cTmpDir := AllTrim( cGetDir( "請選擇圖片存放路徑", cIniDir, .T. ))
please change '/' to '\'
Title is ugly code!!
Re: Bug? cGetDir() on utf8
Posted: Thu Apr 16, 2020 3:18 pm
by karinha
As I don't understand Chinese, try this model.
Code: Select all
#include "FiveWin.ch"
#define BIF_NONEWFOLDERBUTTON 0x200
#define BIF_RETURNONLYFSDIRS 0x0001
#define BIF_DONTGOBELOWDOMAIN 0x0002
#define BIF_STATUSTEXT 0x0004
#define BIF_RETURNFSANCESTORS 0x0008
#define BIF_EDITBOX 0x0010
#define BIF_VALIDATE 0x0020
#define BIF_NEWDIALOGSTYLE 0x0040
#define BIF_USENEWUI (BIF_NEWDIALOGSTYLE | BIF_EDITBOX)
#define BIF_BROWSEINCLUDEURLS 0x0080
#define BIF_BROWSEFORCOMPUTER 0x1000
#define BIF_BROWSEFORPRINTER 0x2000
#define BIF_BROWSEINCLUDEFILES 0x4000
#define BIF_SHAREABLE 0x8000
#define MAX_PATH 260
FUNCTION Main()
LOCAL cTitle, cPath, cCarpDest, cPathDest
cTitle := "Seleccione Carpeta"
cPath := GETCURDIR()
cCarpDest := "Seleccione la carpeta donde copiar las novedades"
cPathDest := cGetDir( cTitle, cPath,, cCarpDest, ;
BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN + ;
BIF_USENEWUI + BIF_NONEWFOLDERBUTTON )
IF .NOT. EMPTY( cPathDest )
? cPathDest
ENDIF
RETURN NIL
Regards, saludos.
Re: Bug? cGetDir() on utf8
Posted: Thu Apr 16, 2020 3:37 pm
by ssbbs
karinha wrote:As I don't understand Chinese, try this model.
Code: Select all
#include "FiveWin.ch"
#define BIF_NONEWFOLDERBUTTON 0x200
#define BIF_RETURNONLYFSDIRS 0x0001
#define BIF_DONTGOBELOWDOMAIN 0x0002
#define BIF_STATUSTEXT 0x0004
#define BIF_RETURNFSANCESTORS 0x0008
#define BIF_EDITBOX 0x0010
#define BIF_VALIDATE 0x0020
#define BIF_NEWDIALOGSTYLE 0x0040
#define BIF_USENEWUI (BIF_NEWDIALOGSTYLE | BIF_EDITBOX)
#define BIF_BROWSEINCLUDEURLS 0x0080
#define BIF_BROWSEFORCOMPUTER 0x1000
#define BIF_BROWSEFORPRINTER 0x2000
#define BIF_BROWSEINCLUDEFILES 0x4000
#define BIF_SHAREABLE 0x8000
#define MAX_PATH 260
FUNCTION Main()
LOCAL cTitle, cPath, cCarpDest, cPathDest
cTitle := "Seleccione Carpeta"
cPath := GETCURDIR()
cCarpDest := "Seleccione la carpeta donde copiar las novedades"
cPathDest := cGetDir( cTitle, cPath,, cCarpDest, ;
BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN + ;
BIF_USENEWUI + BIF_NONEWFOLDERBUTTON )
IF .NOT. EMPTY( cPathDest )
? cPathDest
ENDIF
RETURN NIL
Regards, saludos.
Sorry!! I test it and still fail.
Re: Bug? cGetDir() on utf8
Posted: Thu Apr 16, 2020 5:09 pm
by Natter
you can try this
cDirTmp:=OemToAnsi(HB_UTF8ToStr(cGetDir()))
Re: Bug? cGetDir() on utf8
Posted: Fri Apr 17, 2020 1:49 am
by ssbbs
Natter wrote:you can try this
cDirTmp:=OemToAnsi(HB_UTF8ToStr(cGetDir()))
There are two problems!!
1. Title is showing garbled characters.
2. The initial directory is not expanded
Re: Bug? cGetDir() on utf8
Posted: Sun Apr 19, 2020 2:33 am
by nageswaragunupudi
The present implementation has limitations in Unicode support.
If the user selects a folder containting Unicode characters, the function returns the Unicode test correctly.
Limitations:
1) Title of the dialog can not be Unicode. This is provided in next version.
Sencond title, inside the dialog can be Unicode even in this version
2) Initdir can not be Unicode text. We are still to find a solution.
With the present version, this can be tried:
Code: Select all
? cGetDir( "", cInitDir, nil, "請選擇圖片存放路徑" )
// cInitDir can not contain Unicode characters"
In the next version to be released soon we can have dialog title in Unicode
Code: Select all
local cTitle := "請選擇圖片存放路徑"
? cGetDir( cTitle, cInitDir, nil, cTitle + " 中文目錄" )
Still, cInitDir can not contain Unicode path. We are working on it.
Re: Bug? cGetDir() on utf8
Posted: Sun Apr 19, 2020 8:59 am
by ssbbs
I have solved this problem!
Re: Bug? cGetDir() on utf8
Posted: Sun Apr 19, 2020 9:52 am
by nageswaragunupudi
Can you please share with us how did you solve this problem?
Re: Bug? cGetDir() on utf8
Posted: Sun Apr 19, 2020 1:27 pm
by ssbbs
nageswaragunupudi wrote:Can you please share with us how did you solve this problem?
Give me some rewards, ex: free update once!
Re: Bug? cGetDir() on utf8
Posted: Thu Jul 09, 2020 11:29 am
by richard-service
Hi Mr.Rao
Any news?