From: Harald O. <har...@el...> - 2025-04-16 14:17:02
|
Am 16.04.2025 um 14:03 schrieb Jan Nijtmans: > Op wo 16 apr 2025 om 13:35 schreef Harald Oehlmann: >> thanks for the hint. I have now replaced it with the idom introduced in >> Tcl 8.0 (at least Tcl 8.4): >> >> Tcl_WinUtfToTChar( pStr, lStr, &sPar1); > > That's fine too. Tcl_WinUtfToTChar is platform-dependant > (Windows-only), and works fine. But it is deprecated. The great advantage of Tcl_UtfToWCharDString is, that it appends to the DString, and does not replace it. > The function Tcl_WinTCharToUtf() (the other way round) > has the strange property that the "length" parameter > must be specified in "bytes", not in WCHAR's. That's > one source of confusion. Another one is that > Tcl_WinUtfToTChar and Tcl_WinTCharToUtf don't > accept -1 as length parameter, which should mean > "until the terminating NULL". Tcl_UtfToWCharDString() > is much more useful than Tcl_WinTCharToUtf(). > >> The migration: >> https://core.tcl-lang.org/tcl/wiki?name=Migrating+C+extensions+to+Tcl+9&p >> does not tell anything on this... > > So, that should be extended. All is described here: > <https://core.tcl-lang.org/tips/doc/trunk/tip/548.md> The man-page is here: https://www.tcl-lang.org/man/tcl9.0/TclLib/Utf.html I think, there should be examples here and use-cases. This page does not mention "Tcl_WinUtfToTChar". This command is documented on the encoding.3 man page in 8.6. In Tcl 9.0, it is not documented at all. That is probably ok to not mention deprecated functions. I may fix all this one day. In documentation, I am not so bad as in coding... Thanks for all, Harald |