Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b0595123525fa325e470b1c385bc157189090e1c
Ticket: 414778ffffffffffffffffffffffffffffffffff
Auto wrap Tcl_UtfToExternal
User & Date: davygrvy on 2001-12-15 03:18:08
Changes

  1. icomment:
    Logged In: YES 
    user_id=7549
    
    Wei,
    
    As a final note, Tcl_CreateObjCommand() is much prefered to 
    Tcl_CreateCommand().  I'm only assuming you are using 
    Tcl_CreateCommand() as I had a similar issue once.
    
    If you are using Tcl_CreateObjCommand() already, yes, you 
    will need to prepare the string each and every time with 
    Tcl_UtfToExternalDString() as strings internally to Tcl are 
    meant to be in neutral UTF-8.
    
    for (i = 0; i < objc; i++) { 
    ...
    Tcl_ExternalToUtfDString(NULL,objv[i]->bytes,objv 
    [i]->length,&ds);
    ...
    }
    
    In your patch, looping over the objv array and twiddling 
    with the bytes directly assumes each obj has a valid string 
    rep and kind of breaks the Tcl_Obj concept.
    
    If you could show us an example of your extension code, I 
    could help advise a fix for you.  If you are running on 
    windows only, you could use Tcl_WinUtfToTChar to prep the 
    string.  This will also switch to use unicode if running on 
    NT.
    
    Yes, this conversion stuff is tricky, but well worth the 
    effort to get right.
    
    
  2. login: "davygrvy"
  3. mimetype: "text/plain"
  4. username: "davygrvy"