1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
Index: t_tkcmd.c
===================================================================
--- t_tkcmd.c (revision 9782)
+++ t_tkcmd.c (working copy)
@@ -509,10 +509,14 @@
static int pdCmd(ClientData cd, Tcl_Interp *interp, int argc, char **argv)
{
+ Tcl_DString dstring; /* used to convert the Tcl string to the OS encoding */
+ char *dstring_char;
if (argc == 2)
{
int n = strlen(argv[1]);
- if (send(sockfd, argv[1], n, 0) < n)
+ /* NULL as first arg means use the current system encoding */
+ dstring_char = Tcl_UtfToExternalDString(NULL, argv[1], -1, &dstring);
+ if (send(sockfd, dstring_char, n, 0) < n)
{
perror("stdout");
tcl_mess("exit\n");
@@ -534,12 +538,15 @@
if (i > 1) strcat(buf, " ");
strcat(buf, argv[i]);
}
- if (send(sockfd, buf, strlen(buf), 0) < 0)
+ /* NULL as first arg means use the current system encoding */
+ dstring_char = Tcl_UtfToExternalDString(NULL, buf, -1, &dstring);
+ if (send(sockfd, dstring_char, strlen(dstring_char), 0) < 0)
{
perror("stdout");
tcl_mess("exit\n");
}
}
+ Tcl_DStringFree(&dstring);
return (TCL_OK);
}
|