Changeset 370


Ignore:
Timestamp:
Sep 28, 2008, 6:59:31 PM (17 years ago)
Author:
pr
Message:

Support CP 1208 (UTF-8). Bug 1127.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/cppbase/bs_string_conv.cpp

    r254 r370  
    99
    1010/*
    11  *      This file Copyright (C) 2002 Ulrich M”ller.
     11 *      This file Copyright (C) 2002-2008 Ulrich M”ller.
    1212 *      This program is free software; you can redistribute it and/or modify
    1313 *      it under the terms of the GNU General Public License as published by
     
    4848#pragma hdrstop
    4949
     50#define CP_UTF8         1208
     51
    5052DEFINE_CLASS(BSUniCodec, BSRoot);
    5153
     
    8688 *      constructor. Creates the internal conversion
    8789 *      object by calling encCreateCodec.
     90 *
     91 *@@changed WarpIN V1.0.18 (2008-09-24) [pr]: added codepage 1208 support @@fixes 1127
    8892 */
    8993
     
    9296      _usCodepage(usCodepage)
    9397{
    94     ENCID id = FindEncodingID(usCodepage, &_fDouble);
    95 
     98    ENCID id;
     99
     100    // WarpIN V1.0.18
     101    if (usCodepage == CP_UTF8)
     102    {
     103        _pCodec = NULL;
     104        return;
     105    }
     106
     107    id = FindEncodingID(usCodepage, &_fDouble);
    96108    if (_fDouble)
    97109    {
     
    118130 *      destructor. Frees the internal conversion object
    119131 *      by calling encFreeCodec.
     132 *
     133 *@@changed WarpIN V1.0.18 (2008-09-24) [pr]: added codepage 1208 support @@fixes 1127
    120134 */
    121135
    122136BSUniCodec::~BSUniCodec()
    123137{
    124     encFreeCodec((PCONVERSION*)&_pCodec);
     138    if (_pCodec)
     139    {
     140        encFreeCodec((PCONVERSION*)&_pCodec);
     141        _pCodec = NULL;
     142    }
    125143}
    126144
     
    151169 *      to UTF-8. Used by BSString::assignUtf8 and
    152170 *      others.
     171 *
     172 *@@changed WarpIN V1.0.18 (2008-09-24) [pr]: added codepage 1208 support @@fixes 1127
    153173 */
    154174
     
    158178{
    159179    PCONVERSION pTable = (PCONVERSION)_pCodec;
     180
     181    // WarpIN V1.0.18
     182    if (QueryCodepage() == CP_UTF8)
     183    {
     184        ustr.assignUtf8(pcszCP);
     185        return;
     186    }
    160187
    161188    XSTRING xstrNew;
     
    226253 *      Characters that are not supported with the
    227254 *      given codepage are replaced by '?'.
     255 *
     256 *@@changed WarpIN V1.0.18 (2008-09-24) [pr]: added codepage 1208 support @@fixes 1127
    228257 */
    229258
     
    232261                              unsigned long ulLength)
    233262{
     263    // WarpIN V1.0.18
     264    if (QueryCodepage() == CP_UTF8)
     265    {
     266        str.assign(pcszUni);
     267        return;
     268    }
     269
    234270    PCONVERSION pTable = (PCONVERSION)_pCodec;
    235271
Note: See TracChangeset for help on using the changeset viewer.