Encoding tcl/tk can的国际字符';我没办法

Encoding tcl/tk can的国际字符';我没办法,encoding,tcl,Encoding,Tcl,我使用tcl shellicon命令提取图标,正如下面wiki页面上提到的,其中有一些国际字符问题,然后我编写了一些代码进行测试,但它不起作用,有人能帮我纠正吗 /* * testdll.c * gcc compile: gcc testdll.c -ltclstub86 -ltkstub86 -IC:\Users\L\tcc\include -IC:\Users\L\tcl\include -LC:\Users\L\tcl\lib -LC:\Users\L\tcc\lib -DUSE_TC

我使用tcl shellicon命令提取图标,正如下面wiki页面上提到的,其中有一些国际字符问题,然后我编写了一些代码进行测试,但它不起作用,有人能帮我纠正吗

/*
 * testdll.c
 * gcc compile: gcc testdll.c -ltclstub86 -ltkstub86 -IC:\Users\L\tcc\include -IC:\Users\L\tcl\include -LC:\Users\L\tcl\lib -LC:\Users\L\tcc\lib -DUSE_TCL_STUBS -DUSE_TK_STUBS -shared -o testdll.dll
 */
#include <windows.h>
#include <tcl.h>
#include <stdlib.h>

int TestdllCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) {
    char * path;
    Tcl_DString ds;

    if (objc > 2) {
        Tcl_SetResult(interp, "Usage: testdll ?path?",NULL);
        return TCL_ERROR;
    }
    if (objc == 2) {
        path = Tcl_GetString(objv[objc-1]);
        path = Tcl_TranslateFileName(interp, path, &ds);
        if (path != TCL_OK) {
            return TCL_ERROR;
        }
    }
    Tcl_AppendResult(interp, ds, NULL);
    return TCL_OK;
}

int DLLEXPORT Testdll_Init(Tcl_Interp *interp) {
    if (Tcl_InitStubs(interp, "8.5", 0) == NULL) {
        return TCL_ERROR;
    }
    Tcl_CreateObjCommand(interp, "testdll", TestdllCmd, NULL, NULL);
    Tcl_PkgProvide(interp, "testdll", "1.0");
    return TCL_OK;
}
windows cmd shell运行:tclsh testdll.tcl

load testdll
puts [testdll C:/Users/L/桌面]
输出为:

// This line isn't in the output, just to show the first line of output is a *EMPTY LINE*

    while executing
"testdll 'C:/Users/L/桌面'"
    invoked from within
"puts [testdll 'C:/Users/L/桌面']"
    (file "testdll.tcl" line 2)
实际上,我想打印一行,其内容是“C:/Users/L”/桌面"

我写这个dll是为了调试如何用Tcl_FSGetNormalizedPath、Tcl_FSGetNativePath替换Tcl_GetString、Tcl_TranslateFileName,我想知道是否清楚

谢谢!

删除此:

    if (path != TCL_OK) {
        return TCL_ERROR;
    }
您正在将
char*
int
进行比较

Tcl_TranslateFileName的手册页面上显示:

However,  with  the  advent  of  the  newer Tcl_FSGetNormalizedPath 
and Tcl_FSGetNativePath, there is no longer any need to use this 
procedure.

您可能应该切换到更现代的API调用。

您使用的代码页是什么?请参阅:我想做一个扩展来打印包含汉字的路径,但上面的代码只打印一个错误字符串,它无法打印我输入的内容,即使是普通路径。我使用ascii。请编辑您的问题以包含错误。另外,
load
命令在绝对路径下工作得更好。尝试将其更改为使用testdll文件的绝对路径。您可以使用
load./testdll.dll
。感谢您提供的提示,tcl load可以加载dll,我提到的国际字符问题是testdll.c,我想在其中打印包含中文字符的参数但是结果是它打印了一个空的换行符和其他类似于。。。
However,  with  the  advent  of  the  newer Tcl_FSGetNormalizedPath 
and Tcl_FSGetNativePath, there is no longer any need to use this 
procedure.