Changeset 659 for trunk


Ignore:
Timestamp:
Apr 3, 2007, 4:22:00 PM (17 years ago)
Author:
dkearney
Message:

fixed encoding errors found by nick, now data returned to the user by the decode function is converted to utf-8.
previously i think the data was being converted to unicode by the append to obj function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tcl/src/RpEncodeTclInterface.cc

    r655 r659  
    257257
    258258    option = (const char*) Tcl_GetByteArrayFromObj(objv[nextarg++], &optionLen);
    259 
    260259    if (strncmp(option,"@@RP-ENC:z\n",11) == 0) {
    261260        buf = Rappture::Buffer(option+11,optionLen-11);
     
    420419
    421420    buf.decode(decompress,base64);
     421
    422422    result = Tcl_GetObjResult(interp);
    423423
    424     Tcl_AppendToObj(result,buf.bytes(),buf.size());
     424    Tcl_DString dstPtr;
     425    Tcl_DStringInit(&dstPtr);
     426    Tcl_ExternalToUtfDString(NULL,buf.bytes(),buf.size(),&dstPtr);
     427    Tcl_AppendToObj(result,Tcl_DStringValue(&dstPtr),Tcl_DStringLength(&dstPtr));
     428    Tcl_DStringFree(&dstPtr);
    425429
    426430    return TCL_OK;
Note: See TracChangeset for help on using the changeset viewer.