From: Jan N. <jan...@gm...> - 2025-04-16 11:06:06
|
Op wo 16 apr 2025 om 11:21 schreef Harald Oehlmann: > Here is the relevant code snippet: > > pStr = Tcl_GetStringFromObj(objv[PositionSPar],&lStr); > Tcl_UtfToExternalDString( NULL, pStr, lStr, &sPar1); > TextOut(pdlg.hDC, X0, Y0, Tcl_DStringValue( &sPar1 ), Tcl_DStringLength( > &sPar1 )) My recommendation would be to do this: #if (TCL_MAJOR_VERSION < 9) /* In case of Tcl 8.6 */ # define Tcl_UtfToWCharDString Tcl_UtfToUniCharDString # endif pStr = Tcl_GetStringFromObj(objv[PositionSPar],&lStr); Tcl_DStringInit( &sPar1 ); Tcl_UtfToWCharDString( pStr, lStr, &sPar1); TextOutW(pdlg.hDC, X0, Y0, Tcl_DStringValue( &sPar1 ), Tcl_DStringLength( &sPar1 )/sizeof(WCHAR)); That's what Tcl_UtfToWCharDString was meant for, and it works with any encoding, with or without TIP #716. Hope this helps, Jan Nijtmans |