anchor.diff:    Result := CodePageInfos[Index];
   end;
   
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +function TBuffBaseConverter.MultiByteToWideCharDecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $00: Result := TBuffChar(c1);
  +  else
  +    MultiByteToWideChar(FCodePage, 0, PAnsiChar(@c1), 1, @Result, 1)
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 02.10.2012 --
  +function TBuffBaseConverter.ASCIIDecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $00..$7F: Result := TBuffChar(c1);
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 02.10.2012 --
  +function TBuffBaseConverter.GB2312DecodeChar(c1, c2: Byte): TBuffChar;
  +var
  +  i: Integer;
  +begin
  +  case c1 of
  +    $21..$29, $30..$77:
  +      case c2 of
  +        $21..$7E:
  +        begin
  +          i := 94 * (c1 - $21) + (c2 - $21);
  +          case i of
  +               0.. 830: Result := GB2312_1Map[i];
  +            1410..8177: Result := GB2312_2Map[i - 1410];
  +          else
  +            Result := TBuffChar($FFFD);
  +          end;
  +        end;
  +      else
  +        Result := TBuffChar($FFFD);
  +      end;
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 04.10.2012 --
  +function TBuffBaseConverter.JIS_X0201DecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $5C: Result := #$00A5;
  +    $7E: Result := #$203E;
  +    $A1..$DF: Result := TBuffChar(c1 + $FEC0);
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 04.10.2012 --
  +function TBuffBaseConverter.JIS_X0208DecodeChar(c1, c2: Byte): TBuffChar;
  +var
  +  i: Integer;
  +begin
  +  case c1 of
  +    $21..$27, $30..$73:
  +      case c2 of
  +        $21..$7E:
  +        begin
  +          i := 94 * (c1 - $21) + (c2 - $21);
  +          case i of
  +               0.. 689: Result := JIS_X0208_1Map[i];
  +            1410..7807: Result := JIS_X0208_2Map[i - 1410];
  +          else
  +            Result := TBuffChar($FFFD);
  +          end;
  +        end;
  +      else
  +        Result := TBuffChar($FFFD);
  +      end;
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 04.10.2012 --
  +function TBuffBaseConverter.JIS_X0212DecodeChar(c1, c2: Byte): TBuffChar;
  +var
  +  i: Integer;
  +begin
  +  case c1 of
  +    $22, $26..$27, $29..$2B, $30..$6D:
  +      case c2 of
  +        $21..$7E:
  +        begin
  +          i := 94 * (c1 - $21) + (c2 - $21);
  +          case i of
  +               0.. 174: Result := JIS_X0212_1Map[i - 94];
  +             470.. 657: Result := JIS_X0212_2Map[i - 470];
  +             752..1026: Result := JIS_X0212_3Map[i - 752];
  +            1410..7210: Result := JIS_X0212_4Map[i - 1410];
  +          else
  +            Result := TBuffChar($FFFD);
  +          end;
  +        end;
  +      else
  +        Result := TBuffChar($FFFD);
  +      end;
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 02.10.2012 --
  +function TBuffBaseConverter.KSC5601DecodeChar(c1, c2: Byte): TBuffChar;
  +var
  +  i: Integer;
  +begin
  +  case c1 of
  +    $21..$2C, $30..$48, $4A..$7D:
  +      case c2 of
  +        $21..$7E:
  +        begin
  +          i := 94 * (c1 - $21) + (c2 - $21);
  +          case i of
  +               0..1114: Result := KSC5601_1Map[i];
  +            1410..3759: Result := KSC5601_2Map[i - 1410];
  +            3854..8741: Result := KSC5601_3Map[i - 3854];
  +          else
  +            Result := TBuffChar($FFFD);
  +          end;
  +        end;
  +      else
  +        Result := TBuffChar($FFFD);
  +      end;
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +function TBuffBaseConverter.ISO8859_5DecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $00..$A0, $AD: Result := TBuffChar(c1);
  +    $F0          : Result := #$2116;
  +    $FD          : Result := #$00A7;
  +  else
  +    Result := TBuffChar(c1 + $0360);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +function TBuffBaseConverter.ISO8859_6DecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $00..$A0, $A4, $AD               : Result := TBuffChar(c1);
  +    $AC, $BB, $BF, $C1..$DA, $E0..$F2: Result := TBuffChar(c1 + $0580);
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +function TBuffBaseConverter.ISO8859_7DecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $00..$A0, $A6..$A9, $AB..$AD,
  +    $B0..$B3, $B7, $BB, $BD: Result := TBuffChar(c1);
  +    $A1     : Result := #$2018;
  +    $A2     : Result := #$2019;
  +    $AF     : Result := #$2015;
  +    $D2, $FF: Result := #$FFFF;
  +  else
  +    Result := TBuffChar(c1 + $02D0);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +function TBuffBaseConverter.ISO8859_8DecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $00..$A0, $A2..$A9, $AB..$AE,
  +    $B0..$B9, $BB..$BE: Result := TBuffChar(c1);
  +    $AA     : Result := #$00D7;
  +    $AF     : Result := #$203E;
  +    $BA     : Result := #$00F7;
  +    $DF     : Result := #$2017;
  +    $E0..$FA: Result := TBuffChar(c1 + $04E0);
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +function TBuffBaseConverter.ISO8859_9DecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $D0: Result := #$011E;
  +    $DD: Result := #$0130;
  +    $DE: Result := #$015E;
  +    $F0: Result := #$011F;
  +    $FD: Result := #$0131;
  +    $FE: Result := #$015F;
  +  else
  +    Result := TBuffChar(c1);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +function TBuffBaseConverter.ISO8859_11DecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $00..$A0: Result := TBuffChar(c1);
  +    $A1..$DA,
  +    $DF..$FB: Result := TBuffChar(c1 + $0D60);
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +function TBuffBaseConverter.ISO8859_15DecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $A4: Result := #$20AC;
  +    $A6: Result := #$00A6;
  +    $A8: Result := #$0161;
  +    $B4: Result := #$017D;
  +    $B8: Result := #$017E;
  +    $BC: Result := #$0152;
  +    $BD: Result := #$0153;
  +    $BE: Result := #$0178;
  +  else
  +    Result := TBuffChar(c1);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 03.10.2012 --
  +function TBuffBaseConverter.Latin1EuroDecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $00..$7F: Result := TBuffChar(c1);
  +    $D5: Result := #$20AC;
  +  else
  +    Result := CP850Map[c1];
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 03.10.2012 --
  +function TBuffBaseConverter.CP922EstonianDecodeChar(c1: Byte): TBuffChar;
  +begin
  +  case c1 of
  +    $A0..$AF: Result := CP922_1Map[c1 - $A0];
  +    $D0..$DF: Result := CP922_2Map[c1 - $D0];
  +    $F0..$FF: Result := CP922_3Map[c1 - $F0];
  +  else
  +    Result := TBuffChar(c1);
  +  end;
  +end;
  +
   { TBuffConvSingleByte }
   
  -//-- BG ---------------------------------------------------------- 26.09.2012 --
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +procedure TBuffConvSingleByte.AfterConstruction;
  +begin
  +  inherited;
  +  UpdateDecoder;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +procedure TBuffConvSingleByte.Assign(Source: TBuffConverter);
  +begin
  +  inherited;
  +  UpdateDecoder;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
   function TBuffConvSingleByte.NextChar: TBuffChar;
  -var
  -  Buffer: Word;
  -begin
  -  Buffer := GetNext;
  -  if Buffer <> 0 then
  -    MultiByteToWideChar(FCodePage, 0, PAnsiChar(@Buffer), 1, @Result, 1)
  -  else
  -    Result := TBuffChar(0);
  +begin
  +  Result := FDecoder(GetNext);
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +procedure TBuffConvSingleByte.UpdateDecoder;
  +begin
  +  case FCodePage of
  +      858: FDecoder := Latin1EuroDecodeChar;
  +      922: FDecoder := CP922EstonianDecodeChar;
  +    28595: FDecoder := ISO8859_5DecodeChar;
  +    28596: FDecoder := ISO8859_6DecodeChar;
  +    28597: FDecoder := ISO8859_7DecodeChar;
  +    28598: FDecoder := ISO8859_8DecodeChar;
  +    28599: FDecoder := ISO8859_9DecodeChar;
  +    28601: FDecoder := ISO8859_11DecodeChar;
  +    28605: FDecoder := ISO8859_15DecodeChar;
  +  else
  +    FDecoder := MultiByteToWideCharDecodeChar;
  +  end;
  +end;
  +
  +{ TBuffConvDoubleByte }
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +procedure TBuffConvDoubleByte.AfterConstruction;
  +begin
  +  inherited;
  +  UpdateDecoder;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +procedure TBuffConvDoubleByte.Assign(Source: TBuffConverter);
  +begin
  +  inherited;
  +  UpdateDecoder;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +function TBuffConvDoubleByte.NextChar: TBuffChar;
  +var
  +  c1: Word;
  +begin
  +  c1 := GetNext;
  +  case c1 of
  +    $00..$80: Result := TBuffChar(c1);
  +    $A1..$FE: Result := FDecoder(c1 - $80, GetNext - $80);
  +  else
  +    Result := TBuffChar($FFFD);
  +  end;
  +end;
  +
  +//-- BG ---------------------------------------------------------- 05.10.2012 --
  +procedure TBuffConvDoubleByte.UpdateDecoder;
  +begin
  +  case FCodePage of
  +    51936: FDecoder := GB2312DecodeChar;
  +    51949: FDecoder := KSC5601DecodeChar;
  +  end;
   end;
   
   { TBuffConvUTF8 }
  
positive.code: 
    case KRState1 of
      KRSTATE_ASCII:
        case c1 of
          $00..$7F:
          begin
            Result := TBuffChar(c1);
            case Result of
              #$000A, #$000D:
                KRState2 := KRSTATE2_NONE;
            end;
          end;
        else
          Result := TBuffChar(#$FFFD);
        end;
  
      KRSTATE_TWOBYTE:
      begin
  
negative.code:   function KSC5601Decode(c1, c2: Integer): TBuffChar;
    begin
      Result := KSC5601DecodeChar(c1 - $80, c2 - $80);
    end;
  
  var
    c1, c2: Word;
  begin
    c1 := GetNext;
    case c1 of
  