Subversion Repositories Kolibri OS

Rev

Rev 9896 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9896 Rev 9898
Line 1... Line 1...
1
(*
1
(*
2
    Copyright 2016, 2020, 2022 Anton Krotov
2
    Copyright 2016, 2020, 2022, 2023 Anton Krotov
Line 3... Line 3...
3
 
3
 
Line 4... Line 4...
4
    This file is part of fb2read.
4
    This file is part of fb2read.
5
 
5
 
Line 17... Line 17...
17
    along with fb2read. If not, see .
17
    along with fb2read. If not, see .
18
*)
18
*)
Line 19... Line 19...
19
 
19
 
Line 20... Line 20...
20
MODULE XML;
20
MODULE XML;
Line 21... Line 21...
21
 
21
 
Line 22... Line 22...
22
IMPORT SU := SysUtils, RF := ReadFile, S := Strings, Encode, V := Vector, tables, LISTS;
22
IMPORT SU := SysUtils, RF := ReadFile, S := Strings, E := Encoding, V := Vector, tables, LISTS;
Line 133... Line 133...
133
    Tag_id: LIST;
133
    Tag_id: LIST;
Line 134... Line 134...
134
 
134
 
135
    tire1, tire2, nbsp, ellipsis, apo,
135
    tire1, tire2, nbsp, ellipsis, apo,
136
    quot1, quot2, quot3, quot4, quot5, quot6, quot7,
136
    quot1, quot2, quot3, quot4, quot5, quot6, quot7,
137
    number, bullet, euro,
137
    number, bullet, euro,
Line 138... Line 138...
138
    dash1, dash2: S.UTF8;
138
    dash1, dash2: E.tUtf8;
139
 
139
 
Line 676... Line 676...
676
      chars := attr.value;
676
      chars := attr.value;
677
      INC(chars.first);
677
      INC(chars.first);
678
      DEC(chars.last);
678
      DEC(chars.last);
679
      S.SetCS(FALSE);
679
      S.SetCS(FALSE);
680
      IF    S.CharsEqStr(chars, "windows-1250") THEN
680
      IF    S.CharsEqStr(chars, "windows-1250") THEN
681
        RF.Conv(Encode.W1250)
681
        RF.Conv(E.cp1250)
682
      ELSIF S.CharsEqStr(chars, "windows-1251") THEN
682
      ELSIF S.CharsEqStr(chars, "windows-1251") THEN
683
        RF.Conv(Encode.W1251)
683
        RF.Conv(E.cp1251)
684
      ELSIF S.CharsEqStr(chars, "windows-1252") THEN
684
      ELSIF S.CharsEqStr(chars, "windows-1252") THEN
685
        RF.Conv(Encode.W1252)
685
        RF.Conv(E.cp1252)
686
      ELSIF S.CharsEqStr(chars, "cp866"       ) THEN
686
      ELSIF S.CharsEqStr(chars, "cp866"       ) THEN
687
        RF.Conv(Encode.CP866)
687
        RF.Conv(E.cp866)
688
      ELSIF S.CharsEqStr(chars, "utf-8"       ) THEN
688
      ELSIF S.CharsEqStr(chars, "utf-8"       ) THEN
689
        RF.SeekBeg
689
        RF.SeekBeg
690
      ELSE
690
      ELSE
691
        SU.ErrorIf(TRUE, 14)
691
        SU.ErrorIf(TRUE, 14)
692
      END;
692
      END;
Line 727... Line 727...
727
END Open;
727
END Open;
Line 728... Line 728...
728
 
728
 
729
 
729
 
730
PROCEDURE Init;
730
PROCEDURE Init;
731
BEGIN
731
BEGIN
732
  S.utf8(8212, tire1);
732
  E.utf8(8212, tire1);
733
  S.utf8(8211, tire2);
733
  E.utf8(8211, tire2);
734
  S.utf8( 160, nbsp);
734
  E.utf8( 160, nbsp);
735
  S.utf8(8230, ellipsis);
735
  E.utf8(8230, ellipsis);
736
  S.utf8(8217, apo);
736
  E.utf8(8217, apo);
737
  S.utf8(8220, quot1);
737
  E.utf8(8220, quot1);
738
  S.utf8(8221, quot2);
738
  E.utf8(8221, quot2);
739
  S.utf8(8222, quot3);
739
  E.utf8(8222, quot3);
740
  S.utf8(8216, quot4);
740
  E.utf8(8216, quot4);
741
  S.utf8(8218, quot5);
741
  E.utf8(8218, quot5);
742
  S.utf8(8249, quot6);
742
  E.utf8(8249, quot6);
743
  S.utf8(8250, quot7);
743
  E.utf8(8250, quot7);
744
  S.utf8(8470, number);
744
  E.utf8(8470, number);
745
  S.utf8(8208, dash1);
745
  E.utf8(8208, dash1);
746
  S.utf8(8209, dash2);
746
  E.utf8(8209, dash2);
747
  S.utf8(8226, bullet);
747
  E.utf8(8226, bullet);
748
  S.utf8(8364, euro);
748
  E.utf8(8364, euro);
Line 749... Line 749...
749
  Tags := V.create(1024)
749
  Tags := V.create(1024)