@@ -864,6 +864,30 @@ static uint8_t pm_encoding_koi8_r_table[256] = {
864
864
7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , // Fx
865
865
};
866
866
867
+ /**
868
+ * Each element of the following table contains a bitfield that indicates a
869
+ * piece of information about the corresponding KOI8-U character.
870
+ */
871
+ static uint8_t pm_encoding_koi8_u_table [256 ] = {
872
+ // 0 1 2 3 4 5 6 7 8 9 A B C D E F
873
+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , // 0x
874
+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , // 1x
875
+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , // 2x
876
+ 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , // 3x
877
+ 0 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , // 4x
878
+ 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 0 , 0 , 0 , 0 , 0 , // 5x
879
+ 0 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , // 6x
880
+ 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 0 , 0 , 0 , 0 , 0 , // 7x
881
+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , // 8x
882
+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , // 9x
883
+ 0 , 0 , 0 , 3 , 3 , 0 , 3 , 3 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , // Ax
884
+ 0 , 0 , 0 , 7 , 7 , 0 , 7 , 7 , 0 , 0 , 0 , 0 , 0 , 7 , 0 , 0 , // Bx
885
+ 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , // Cx
886
+ 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , // Dx
887
+ 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , // Ex
888
+ 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , // Fx
889
+ };
890
+
867
891
/**
868
892
* Each element of the following table contains a bitfield that indicates a
869
893
* piece of information about the corresponding macCentEuro character.
@@ -1418,7 +1442,7 @@ pm_encoding_single_char_width(PRISM_ATTRIBUTE_UNUSED const uint8_t *b, PRISM_ATT
1418
1442
* checking if it's a valid codepoint in KOI-8 and if it is returning 1.
1419
1443
*/
1420
1444
static size_t
1421
- pm_encoding_koi8_r_char_width (const uint8_t * b , PRISM_ATTRIBUTE_UNUSED ptrdiff_t n ) {
1445
+ pm_encoding_koi8_char_width (const uint8_t * b , PRISM_ATTRIBUTE_UNUSED ptrdiff_t n ) {
1422
1446
return ((* b >= 0x20 && * b <= 0x7E ) || (* b >= 0x80 )) ? 1 : 0 ;
1423
1447
}
1424
1448
@@ -1468,6 +1492,7 @@ PRISM_ENCODING_TABLE(iso_8859_14)
1468
1492
PRISM_ENCODING_TABLE (iso_8859_15 )
1469
1493
PRISM_ENCODING_TABLE (iso_8859_16 )
1470
1494
PRISM_ENCODING_TABLE (koi8_r )
1495
+ PRISM_ENCODING_TABLE (koi8_u )
1471
1496
PRISM_ENCODING_TABLE (mac_cent_euro )
1472
1497
PRISM_ENCODING_TABLE (mac_croatian )
1473
1498
PRISM_ENCODING_TABLE (mac_cyrillic )
@@ -1855,13 +1880,23 @@ pm_encoding_t pm_encoding_iso_8859_16 = {
1855
1880
/** KOI8-R */
1856
1881
pm_encoding_t pm_encoding_koi8_r = {
1857
1882
.name = "KOI8-R" ,
1858
- .char_width = pm_encoding_koi8_r_char_width ,
1883
+ .char_width = pm_encoding_koi8_char_width ,
1859
1884
.alnum_char = pm_encoding_koi8_r_alnum_char ,
1860
1885
.alpha_char = pm_encoding_koi8_r_alpha_char ,
1861
1886
.isupper_char = pm_encoding_koi8_r_isupper_char ,
1862
1887
.multibyte = false
1863
1888
};
1864
1889
1890
+ /** KOI8-U */
1891
+ pm_encoding_t pm_encoding_koi8_u = {
1892
+ .name = "KOI8-U" ,
1893
+ .char_width = pm_encoding_koi8_char_width ,
1894
+ .alnum_char = pm_encoding_koi8_u_alnum_char ,
1895
+ .alpha_char = pm_encoding_koi8_u_alpha_char ,
1896
+ .isupper_char = pm_encoding_koi8_u_isupper_char ,
1897
+ .multibyte = false
1898
+ };
1899
+
1865
1900
/** macCentEuro */
1866
1901
pm_encoding_t pm_encoding_mac_cent_euro = {
1867
1902
.name = "macCentEuro" ,
0 commit comments