Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 821ae10be92996a07e3ce3c4efac6d420b6f93b8
Ticket: 459115ffffffffffffffffffffffffffffffffff
_MBCS,_UNICODE,Tcl_WinUtfToTChar abuse!
User & Date: dacut on 2001-09-10 08:33:02
Changes

  1. icomment:
    Logged In: YES 
    user_id=31992
    
    Well, I'm waiting to hear back from Jeff on whether he has any insight on this.  In the meantime, I'll post my 
    ignorance...
    
    TCHAR is either a char (for SBCS or MBCS) or wchar_t (for Unicode); which definition it gets is defined by 
    the UNICODE preprocessor macro.  Along with the TEXT() macro and the various tcsxxx() functions, the 
    intended usage is to port an application between SBCS/MBCS and Unicode easily -- that is, an application 
    can be switched between the two by flipping the UNICODE macro.
    
    But this is reserved for the application.  It is, IMHO, dangerous to have this *anywhere* in Tcl.  Dave G 
    points out the problem keenly (though reality is the reverse: Tcl_WinUtfToTChar always returns Unicode 
    strings, never MBCS).
    
    Anyway... looking at the various files, it seems like the functions accepting/returning TCHARs and TCHAR *'s 
    should use UTF-16 instead.  Tcl_UniChar should work fine.
    
    Note that the C++ intrinsic wchar_t doesn't exist intrinsically in C, and is the wrong size on most Unix 
    compilers -- UTF-32 instead of UTF-16.  WCHAR could be used if we're willing to bring in the windows.h 
    header (which may be just as well -- we'll know of clashes right away, and since both MSVC and BC 
    implement precompiled headers...).
    
    
    
  2. login: "dacut"
  3. mimetype: "text/plain"
  4. username: "dacut"