Re: Unicode or ASCII - perhabs that a problem?
- From: "MartinLemburg@UGS" <martin.lemburg.ugs@xxxxxxx>
- Date: 5 Sep 2006 10:57:22 -0700
Perhabs the solution for now, even if a bit unsatisfying:
1. I loop over the Tcl_Obj's
2. I get the length of the unicode string with Tcl_GetCharLength
3. I loop over the unicode chars with Tcl_GetUniChar and store each
Tcl_UniChar in a char array
4. I use this char array inside the attached library, which uses fopen
Do somebody have a better solution for tcl 8.4a2 (no upgrade possible
yet)?
Best regards,
Martin Lemburg
UGS - Transforming the Process of Innovation
MartinLemburg@UGS wrote:
Ok - one step back.
Tcl_UniCode returns Tcl_UniChar*, which is an array of "unsigned
short"s.
How can I get the (in the debugger right looking) represented string
(Tcl_UniChar*) to my "normal" char* string?
I tried with Tcl_UniCharToUtfDString, but the Tcl_DString contained
still it scrambled file name, I can not use with fopen.
-----
In this context - please don't ask for using Tcl_Channels, the tcl file
access API, because the library below this Tcl_(Obj)?CmdProc interface
is completely free from any tcl and uses fopen. This is not changable!
-----
Thanks again! I'm happy for every suggestion!
Martin Lemburg
UGS - Transforming the Process of Innovation
MartinLemburg@UGS wrote:
A change or extension of my question!
I found Tcl_UniCode to return the right string - the string I expected
to get (.../binär/somefile).
But now - must I free this unicode string with Tcl_Free?
I know, that I must not free the string represented by the char*
returned from Tcl_GetStringFromObj, but how to care for with the
returned pointer from Tcl_UniCode?
Thanks again,
Martin Lemburg
MartinLemburg@UGS wrote:
Hello,
we extended a tcl shell with some commands written in C++. Those
commands were created a long time ago and uses the Tcl_CmdProc instead
of the Tcl_ObjCmdProc interface.
Now we transfer a file name containing "umlaute" to one of these
commands and suddenly, this file name, this string seems to be
scrambled like:
.../binär/somefile
to
.../binĤr/somefile
Using now fopen on this scrambled file name, causes fopen to fail.
I reworked the tcl commands to use the Tcl_ObjCmdProc, but still
accessing the Tcl_Obj's string representation contains this scrambled
file name.
Is this a conflict between tcl 8.4's Unicode features and the usage of
the strings as normal char*?
Thanks and best regards,
Martin Lemburg
UGS - Transforming the Process of Innovation
.
- Follow-Ups:
- Re: Unicode or ASCII - perhabs that a problem?
- From: Don Porter
- Re: Unicode or ASCII - perhabs that a problem?
- References:
- Unicode or ASCII - perhabs that a problem?
- From: MartinLemburg@UGS
- Re: Unicode or ASCII - perhabs that a problem?
- From: MartinLemburg@UGS
- Re: Unicode or ASCII - perhabs that a problem?
- From: MartinLemburg@UGS
- Unicode or ASCII - perhabs that a problem?
- Prev by Date: Re: Question about AS licence
- Next by Date: Re: Need header(tcl.h) and libraries(tcl84.lib) to compile against eTcl
- Previous by thread: Re: Unicode or ASCII - perhabs that a problem?
- Next by thread: Re: Unicode or ASCII - perhabs that a problem?
- Index(es):
Relevant Pages
|