#2562 Tcl_EvalFile for chinese path in Win2000, occur failed

obsolete: 8.4.5
closed-invalid
5
2004-06-29
2003-12-30
rong bing
No

Tcl_EvalFile for chinese path in Win2000, occur failed:

void CTclExecDlg::OnButtonRun()
{
UpdateData(TRUE);

Tcl_FindExecutable(AfxGetApp()-
>m_pszExeName);

Tcl_Interp* pInterp = Tcl_CreateInterp();
if(pInterp == NULL)
{
TRACE(_T("Interp create failed.
"));
return;
}
Tcl_Preserve((ClientData)pInterp);

char scriptFile[1024];
strcpy(scriptFile, m_sScriptPath);

Tcl_DString tStr1;
Tcl_ExternalToUtfDString(NULL, scriptFile, -1,
&tStr1);

int result = Tcl_EvalFile(pInterp,
Tcl_DStringValue(&tStr1));
if (TCL_OK != result )
{
TRACE(_T("Execute failed.
"));
}
Tcl_DStringFree(&tStr1);

if(Tcl_InterpDeleted(pInterp) == 0)
Tcl_DeleteInterp(pInterp);
Tcl_Release((ClientData)pInterp);
}

Discussion

  • Don Porter

    Don Porter - 2003-12-31

    Logged In: YES
    user_id=80530

    what is the value of m_sScriptPath?
    and what encoding is it in?
    and what is the system encoding?

     
  • rong bing

    rong bing - 2004-01-08

    Logged In: YES
    user_id=940212

    m_sScriptPath is "D:\Softphone2.2\project\ICD3.0平台
    \rule\rb2004\my.tcl".

    encoding is CP936.

    System encoding is CP936.

     
  • miguel sofer

    miguel sofer - 2004-01-08
    • assigned_to: msofer --> dgp
     
  • miguel sofer

    miguel sofer - 2004-01-08

    Logged In: YES
    user_id=148712

    Don: you spoke up, it's all yours - I wouldn't know where to
    start

     
  • rong bing

    rong bing - 2004-01-10

    Logged In: YES
    user_id=940212

    The attached file is my test program. When we click RUN
    button, Tcl_EvalFile will return "counldn't read file
    D:\Softphone2.2\PROJECT\ICD3.0平台\Rules\my.tcl: no such
    file or directory". My OS is WinXP chinese version.

     
  • Don Porter

    Don Porter - 2004-01-14

    Logged In: YES
    user_id=80530

    there is no file attached.

     
  • David Gravereaux

    Logged In: YES
    user_id=7549

    D:\Softphone2.2\PROJECT\ICD3.0平台\Rules\my.tcl

    Is the filename displayed in the error message the correct
    filename as you expect to see it?

     
  • bladesun

    bladesun - 2004-06-28

    Logged In: YES
    user_id=1072261

    I have encountered the similar problem!
    my OS: win2000 SP4 Chinese
    my Tcl Realese: ActiveTcl8.4.6.1-win32-ix86-99631

    following is my very simple program:

    void main(int argc, char *argv[]){
    char *str = "D:/MyCode/Going/test.tcl";
    Tcl_Interp* interp=Tcl_CreateInterp();
    Tcl_Init(interp);

    if(TCL_OK!=Tcl_EvalFile(interp, str)){
    Tcl_DeleteInterp(interp);
    return;
    }
    Tcl_DeleteInterp(interp);
    exit(0);
    }

    successed compling under VC6.0!
    when executing, segment erroe occur, the OS message just
    like this(translated from chinese):
    Instruction "0x00000000" references "0x00000000" address
    which cann't be read
    when debugging in VC, the message is:
    Unhandled exception in myprom.exe:0xC0000005: Access
    Violation.

     
  • Nobody/Anonymous

    Logged In: NO

    PS: I tested the same program under tcl8.3.5(complied using
    tcl8.3.5-src.tar.gz from here), there is no problem!

     
  • bladesun

    bladesun - 2004-06-28

    Logged In: YES
    user_id=1072261

    PS: I tested the same program under tcl8.3.5(complied using
    tcl8.3.5-src.tar.gz from here), there is no problem!

     
  • Don Porter

    Don Porter - 2004-06-28

    Logged In: YES
    user_id=80530

    bladesun, your example program
    is missing a call to Tcl_FindExecutable().

    Add

    Tcl_FindExecutable(argv[0])

    before the Tcl_CreateInterp()
    call, and see if that corrects
    your trouble.

     
  • bladesun

    bladesun - 2004-06-29

    Logged In: YES
    user_id=1072261

    dgp, you are right!
    It seems to be my fault ...
    but why not keep upward compatible?

     
  • Don Porter

    Don Porter - 2004-06-29

    Logged In: YES
    user_id=80530

    Tcl_FindExecutable() calls
    have been required since Tcl 8.1.
    It's a mystery to me why your
    program worked with 8.3.

     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2004-06-29
    • status: open --> closed-invalid
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2004-06-29

    Logged In: YES
    user_id=72656

    The Tcl_FindExecutable was correct for 8.1+ and documented
    as such. It became essential with 8.4 changes, whereas
    before you could get away without it - but it was still
    supposed to be there.