507
return { seemsBinary, encoding };
508
}
510
>
type EncodingsMap = { [encoding: string]: { labelLong: string; labelShort: string; order: number; encodeOnly?: boolean; alias?: string; guessableName?: string } };
511
>
512
>
export const SUPPORTED_ENCODINGS: EncodingsMap = {
513
>
utf8: {
514
>
labelLong: 'UTF-8',
515
>
labelShort: 'UTF-8',
516
>
order: 1,
517
>
alias: 'utf8bom',
518
>
guessableName: 'UTF-8'
519
>
},
520
>
utf8bom: {
521
>
labelLong: 'UTF-8 with BOM',
522
>
labelShort: 'UTF-8 with BOM',
523
>
encodeOnly: true,
524
>
order: 2,
525
>
alias: 'utf8'
526
>
},
527
>
utf16le: {
528
>
labelLong: 'UTF-16 LE',
529
>
labelShort: 'UTF-16 LE',
530
>
order: 3,
531
>
guessableName: 'UTF-16LE'
532
>
},
533
>
utf16be: {
534
>
labelLong: 'UTF-16 BE',
535
>
labelShort: 'UTF-16 BE',
536
>
order: 4,
537
>
guessableName: 'UTF-16BE'
538
>
},
539
>
windows1252: {
540
>
labelLong: 'Western (Windows 1252)',
541
>
labelShort: 'Windows 1252',
542
>
order: 5,
543
>
guessableName: 'windows-1252'
544
>
},
545
>
iso88591: {
546
>
labelLong: 'Western (ISO 8859-1)',
547
>
labelShort: 'ISO 8859-1',
548
>
order: 6
549
>
},
550
>
iso88593: {
551
>
labelLong: 'Western (ISO 8859-3)',
552
>
labelShort: 'ISO 8859-3',
553
>
order: 7
554
>
},
555
>
iso885915: {
556
>
labelLong: 'Western (ISO 8859-15)',
557
>
labelShort: 'ISO 8859-15',
558
>
order: 8
559
>
},
560
>
macroman: {
561
>
labelLong: 'Western (Mac Roman)',
562
>
labelShort: 'Mac Roman',
563
>
order: 9
564
>
},
565
>
cp437: {
566
>
labelLong: 'DOS (CP 437)',
567
>
labelShort: 'CP437',
568
>
order: 10
569
>
},
570
>
windows1256: {
571
>
labelLong: 'Arabic (Windows 1256)',
572
>
labelShort: 'Windows 1256',
573
>
order: 11
574
>
},
575
>
iso88596: {
576
>
labelLong: 'Arabic (ISO 8859-6)',
577
>
labelShort: 'ISO 8859-6',
578
>
order: 12
579
>
},
580
>
windows1257: {
581
>
labelLong: 'Baltic (Windows 1257)',
582
>
labelShort: 'Windows 1257',
583
>
order: 13
584
>
},
585
>
iso88594: {
586
>
labelLong: 'Baltic (ISO 8859-4)',
587
>
labelShort: 'ISO 8859-4',
588
>
order: 14
589
>
},
590
>
iso885914: {
591
>
labelLong: 'Celtic (ISO 8859-14)',
592
>
labelShort: 'ISO 8859-14',
593
>
order: 15
594
>
},
595
>
windows1250: {
596
>
labelLong: 'Central European (Windows 1250)',
597
>
labelShort: 'Windows 1250',
598
>
order: 16,
599
>
guessableName: 'windows-1250'
600
>
},
601
>
iso88592: {
602
>
labelLong: 'Central European (ISO 8859-2)',
603
>
labelShort: 'ISO 8859-2',
604
>
order: 17,
605
>
guessableName: 'ISO-8859-2'
606
>
},
607
>
cp852: {
608
>
labelLong: 'Central European (CP 852)',
609
>
labelShort: 'CP 852',
610
>
order: 18
611
>
},
612
>
windows1251: {
613
>
labelLong: 'Cyrillic (Windows 1251)',
614
>
labelShort: 'Windows 1251',
615
>
order: 19,
616
>
guessableName: 'windows-1251'
617
>
},
618
>
cp866: {
619
>
labelLong: 'Cyrillic (CP 866)',
620
>
labelShort: 'CP 866',
621
>
order: 20,
622
>
guessableName: 'IBM866'
623
>
},
624
>
cp1125: {
625
>
labelLong: 'Cyrillic (CP 1125)',
626
>
labelShort: 'CP 1125',
627
>
order: 21,
628
>
guessableName: 'IBM1125'
629
>
},
630
>
iso88595: {
631
>
labelLong: 'Cyrillic (ISO 8859-5)',
632
>
labelShort: 'ISO 8859-5',
633
>
order: 22,
634
>
guessableName: 'ISO-8859-5'
635
>
},
636
>
koi8r: {
637
>
labelLong: 'Cyrillic (KOI8-R)',
638
>
labelShort: 'KOI8-R',
639
>
order: 23,
640
>
guessableName: 'KOI8-R'
641
>
},
642
>
koi8u: {
643
>
labelLong: 'Cyrillic (KOI8-U)',
644
>
labelShort: 'KOI8-U',
645
>
order: 24
646
>
},
647
>
iso885913: {
648
>
labelLong: 'Estonian (ISO 8859-13)',
649
>
labelShort: 'ISO 8859-13',
650
>
order: 25
651
>
},
652
>
windows1253: {
653
>
labelLong: 'Greek (Windows 1253)',
654
>
labelShort: 'Windows 1253',
655
>
order: 26,
656
>
guessableName: 'windows-1253'
657
>
},
658
>
iso88597: {
659
>
labelLong: 'Greek (ISO 8859-7)',
660
>
labelShort: 'ISO 8859-7',
661
>
order: 27,
662
>
guessableName: 'ISO-8859-7'
663
>
},
664
>
windows1255: {
665
>
labelLong: 'Hebrew (Windows 1255)',
666
>
labelShort: 'Windows 1255',
667
>
order: 28,
668
>
guessableName: 'windows-1255'
669
>
},
670
>
iso88598: {
671
>
labelLong: 'Hebrew (ISO 8859-8)',
672
>
labelShort: 'ISO 8859-8',
673
>
order: 29,
674
>
guessableName: 'ISO-8859-8'
675
>
},
676
>
iso885910: {
677
>
labelLong: 'Nordic (ISO 8859-10)',
678
>
labelShort: 'ISO 8859-10',
679
>
order: 30
680
>
},
681
>
iso885916: {
682
>
labelLong: 'Romanian (ISO 8859-16)',
683
>
labelShort: 'ISO 8859-16',
684
>
order: 31
685
>
},
686
>
windows1254: {
687
>
labelLong: 'Turkish (Windows 1254)',
688
>
labelShort: 'Windows 1254',
689
>
order: 32
690
>
},
691
>
iso88599: {
692
>
labelLong: 'Turkish (ISO 8859-9)',
693
>
labelShort: 'ISO 8859-9',
694
>
order: 33
695
>
},
696
>
cp857: {
697
>
labelLong: 'Turkish (CP 857)',
698
>
labelShort: 'CP 857',
699
>
order: 34
700
>
},
701
>
windows1258: {
702
>
labelLong: 'Vietnamese (Windows 1258)',
703
>
labelShort: 'Windows 1258',
704
>
order: 35
705
>
},
706
>
gbk: {
707
>
labelLong: 'Simplified Chinese (GBK)',
708
>
labelShort: 'GBK',
709
>
order: 36
710
>
},
711
>
gb18030: {
712
>
labelLong: 'Simplified Chinese (GB18030)',
713
>
labelShort: 'GB18030',
714
>
order: 37
715
>
},
716
>
cp950: {
717
>
labelLong: 'Traditional Chinese (Big5)',
718
>
labelShort: 'Big5',
719
>
order: 38,
720
>
guessableName: 'Big5'
721
>
},
722
>
big5hkscs: {
723
>
labelLong: 'Traditional Chinese (Big5-HKSCS)',
724
>
labelShort: 'Big5-HKSCS',
725
>
order: 39
726
>
},
727
>
shiftjis: {
728
>
labelLong: 'Japanese (Shift JIS)',
729
>
labelShort: 'Shift JIS',
730
>
order: 40,
731
>
guessableName: 'SHIFT_JIS'
732
>
},
733
>
eucjp: {
734
>
labelLong: 'Japanese (EUC-JP)',
735
>
labelShort: 'EUC-JP',
736
>
order: 41,
737
>
guessableName: 'EUC-JP'
738
>
},
739
>
euckr: {
740
>
labelLong: 'Korean (EUC-KR)',
741
>
labelShort: 'EUC-KR',
742
>
order: 42,
743
>
guessableName: 'EUC-KR'
744
>
},
745
>
windows874: {
746
>
labelLong: 'Thai (Windows 874)',
747
>
labelShort: 'Windows 874',
748
>
order: 43
749
>
},
750
>
iso885911: {
751
>
labelLong: 'Latin/Thai (ISO 8859-11)',
752
>
labelShort: 'ISO 8859-11',
753
>
order: 44
754
>
},
755
>
koi8ru: {
756
>
labelLong: 'Cyrillic (KOI8-RU)',
757
>
labelShort: 'KOI8-RU',
758
>
order: 45
759
>
},
760
>
koi8t: {
761
>
labelLong: 'Tajik (KOI8-T)',
762
>
labelShort: 'KOI8-T',
763
>
order: 46
764
>
},
765
>
gb2312: {
766
>
labelLong: 'Simplified Chinese (GB 2312)',
767
>
labelShort: 'GB 2312',
768
>
order: 47,
769
>
guessableName: 'GB2312'
770
>
},
771
>
cp865: {
772
>
labelLong: 'Nordic DOS (CP 865)',
773
>
labelShort: 'CP 865',
774
>
order: 48
775
>
},
776
>
cp850: {
777
>
labelLong: 'Western European DOS (CP 850)',
778
>
labelShort: 'CP 850',
779
>
order: 49
780
>
}
781
>
};
782
>
783
>
export const GUESSABLE_ENCODINGS: EncodingsMap = (() => {
784
>
const guessableEncodings: EncodingsMap = {};
785
>
for (const encoding in SUPPORTED_ENCODINGS) {
786
>
if (SUPPORTED_ENCODINGS[encoding].guessableName) {
787
>
guessableEncodings[encoding] = SUPPORTED_ENCODINGS[encoding];
788
>
}
789
>
}
790
>
791
>
return guessableEncodings;
792
>
})();