mirror of
https://github.com/DigitalDevices/octonet.git
synced 2023-10-10 13:36:52 +02:00
character code tables 0..11 added, (ISO/IEC 8859-5..15)
This commit is contained in:
parent
5e9b9f9689
commit
4f252ccb48
@ -1124,74 +1124,235 @@ static int pat_cb(struct sfilter *sf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define UTF8_CC_START 0xc2
|
||||
#define SB_CC_RESERVED_80 0x80
|
||||
#define SB_CC_RESERVED_81 0x81
|
||||
#define SB_CC_RESERVED_82 0x82
|
||||
#define SB_CC_RESERVED_83 0x83
|
||||
#define SB_CC_RESERVED_84 0x84
|
||||
#define SB_CC_RESERVED_85 0x85
|
||||
#define CHARACTER_RESERVED_80 0x80
|
||||
#define CHARACTER_RESERVED_81 0x81
|
||||
#define CHARACTER_RESERVED_82 0x82
|
||||
#define CHARACTER_RESERVED_83 0x83
|
||||
#define CHARACTER_RESERVED_84 0x84
|
||||
#define CHARACTER_RESERVED_85 0x85
|
||||
#define CHARACTER_EMPHASIS_ON 0x86
|
||||
#define CHARACTER_EMPHASIS_OFF 0x87
|
||||
#define SB_CC_RESERVED_88 0x88
|
||||
#define SB_CC_RESERVED_89 0x89
|
||||
#define CHARACTER_CR_LF 0x8a
|
||||
#define SB_CC_USER_8B 0x8b
|
||||
#define SB_CC_USER_9F 0x9f
|
||||
#define CHARACTER_RESERVED_88 0x88
|
||||
#define CHARACTER_RESERVED_89 0x89
|
||||
#define CHARACTER_CR_LF 0x8A
|
||||
#define CHARACTER_USER_8B 0x8B
|
||||
#define CHARACTER_USER_9F 0x9F
|
||||
|
||||
void en300468_parse_string_to_utf8(char *dest, uint8_t *src,
|
||||
const unsigned int len)
|
||||
uint16_t codetable_00[96] = {
|
||||
0x00A0,0x00A1,0x00A2,0x00A3, 0x20AC,0x00A5,0x0000,0x00A7, 0x00A4,0x2018,0x201C,0x00AB, 0x2190,0x2191,0x2192,0x2193,
|
||||
0x00B0,0x00B1,0x00B2,0x00B3, 0x00B4,0x00B5,0x00B6,0x00B7, 0x00F7,0x2019,0x201D,0x00BB, 0x00BC,0x00BD,0x00BE,0x00BF,
|
||||
0x0000,0x0300,0x0301,0x0302, 0x0303,0x0304,0x0306,0x0307, 0x0308,0x0000,0x030A,0x0327, 0x0000,0x030B,0x0328,0x030C,
|
||||
0x2015,0x00B9,0x00AE,0x00A9, 0x2122,0x266A,0x00AC,0x00A6, 0x0000,0x0000,0x0000,0x0000, 0x215B,0x215C,0x215D,0x215E,
|
||||
0x2126,0x00C6,0x0110,0x00AA, 0x0126,0x0000,0x0132,0x013F, 0x0141,0x00D8,0x0152,0x00BA, 0x00DE,0x0166,0x014A,0x0149,
|
||||
0x0138,0x00E6,0x0111,0x00F0, 0x0127,0x0131,0x0133,0x0140, 0x0142,0x00F8,0x0153,0x00DF, 0x00FE,0x0167,0x014B,0x00AD,
|
||||
};
|
||||
|
||||
uint16_t codetable_01[96] = {
|
||||
0x00A0,0x0401,0x0402,0x0403, 0x0404,0x0405,0x0406,0x0407, 0x0408,0x0409,0x040A,0x040B, 0x040C,0x00AD,0x040E,0x040F,
|
||||
0x0410,0x0411,0x0412,0x0413, 0x0414,0x0415,0x0416,0x0417, 0x0418,0x0419,0x041A,0x041B, 0x041C,0x041D,0x041E,0x041F,
|
||||
0x0420,0x0421,0x0422,0x0423, 0x0424,0x0425,0x0426,0x0427, 0x0428,0x0429,0x042A,0x042B, 0x042C,0x042D,0x042E,0x042F,
|
||||
0x0430,0x0431,0x0432,0x0433, 0x0434,0x0435,0x0436,0x0437, 0x0438,0x0439,0x043A,0x043B, 0x043C,0x043D,0x043E,0x043F,
|
||||
0x0440,0x0441,0x0442,0x0443, 0x0444,0x0445,0x0446,0x0447, 0x0448,0x0449,0x044A,0x044B, 0x044C,0x044D,0x044E,0x044F,
|
||||
0x2116,0x0451,0x0452,0x0453, 0x0454,0x0455,0x0456,0x0457, 0x0458,0x0459,0x045A,0x045B, 0x045C,0x00A7,0x045E,0x045F,
|
||||
};
|
||||
|
||||
uint16_t codetable_02[96] = {
|
||||
0x00A0,0x0000,0x0000,0x0000, 0x00A4,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, 0x060C,0x00AD,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x061B, 0x0000,0x0000,0x0000,0x061F,
|
||||
0x0000,0x0621,0x0622,0x0623, 0x0624,0x0625,0x0626,0x0627, 0x0628,0x0629,0x062A,0x062B, 0x062C,0x062D,0x062E,0x062F,
|
||||
0x0630,0x0631,0x0632,0x0633, 0x0634,0x0635,0x0636,0x0637, 0x0638,0x0639,0x063A,0x0000, 0x0000,0x0000,0x0000,0x0000,
|
||||
0x0640,0x0641,0x0642,0x0643, 0x0644,0x0645,0x0646,0x0647, 0x0648,0x0649,0x064A,0x064B, 0x064C,0x064D,0x064E, 0x064F,
|
||||
0x0650,0x0651,0x0652,0x0000, 0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,
|
||||
};
|
||||
|
||||
uint16_t codetable_03[96] = {
|
||||
0x00A0,0x2018,0x2019,0x00A3, 0x20AC,0x20AF,0x00A6,0x00A7, 0x00A8,0x00A9,0x037A,0x00AB, 0x00AC,0x00AD,0x0000,0x2015,
|
||||
0x00B0,0x00B1,0x00B2,0x00B3, 0x0384,0x0385,0x0386,0x00B7, 0x0388,0x0389,0x038A,0x00BB, 0x038C,0x00BD,0x038E,0x038F,
|
||||
0x0390,0x0391,0x0392,0x0393, 0x0394,0x0395,0x0396,0x0397, 0x0398,0x0399,0x039A,0x039B, 0x039C,0x039D,0x039E,0x039F,
|
||||
0x03A0,0x03A1,0x0000,0x03A3, 0x03A4,0x03A5,0x03A6,0x03A7, 0x03A8,0x03A9,0x03AA,0x03AB, 0x03AC,0x03AD,0x03AE,0x03AF,
|
||||
0x03B0,0x03B1,0x03B2,0x03B3, 0x03B4,0x03B5,0x03B6,0x03B7, 0x03B8,0x03B9,0x03BA,0x03BB, 0x03BC,0x03BD,0x03BE,0x03BF,
|
||||
0x03C0,0x03C1,0x03C2,0x03C3, 0x03C4,0x03C5,0x03C6,0x03C7, 0x03C8,0x03C9,0x03CA,0x03CB, 0x03CC,0x03CD,0x03CE,0x0000,
|
||||
};
|
||||
|
||||
uint16_t codetable_04[96] = {
|
||||
0x00A0,0x0000,0x00A2,0x00A3, 0x00A4,0x00A5,0x00A6,0x00A7, 0x00A8,0x00A9,0x00D7,0x00AB, 0x00AC,0x00AD,0x00AE,0x00AF,
|
||||
0x00B0,0x00B1,0x00B2,0x00B3, 0x00B4,0x00B5,0x00B6,0x00B7, 0x00B8,0x00B9,0x00F7,0x00BB, 0x00BC,0x00BD,0x00BE,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x2017,
|
||||
0x05D0,0x05D1,0x05D2,0x05D3, 0x05D4,0x05D5,0x05D6,0x05D7, 0x05D8,0x05D9,0x05DA,0x05DB, 0x05DC,0x05DD,0x05DE,0x05DF,
|
||||
0x05E0,0x05E1,0x05E2,0x05E3, 0x05E4,0x05E5,0x05E6,0x05E7, 0x05E8,0x05E9,0x05EA,0x0000, 0x0000,0x200E,0x200F,0x0000,
|
||||
};
|
||||
|
||||
uint16_t codetable_05[96] = {
|
||||
0x00A0,0x00A1,0x00A2,0x00A3, 0x00A4,0x00A5,0x00A6,0x00A7, 0x00A8,0x00A9,0x00AA,0x00AB, 0x00AC,0x00AD,0x00AE,0x00AF,
|
||||
0x00B0,0x00B1,0x00B2,0x00B3, 0x00B4,0x00B5,0x00B6,0x00B7, 0x00B8,0x00B9,0x00BA,0x00BB, 0x00BC,0x00BD,0x00BE,0x00BF,
|
||||
0x00C0,0x00C1,0x00C2,0x00C3, 0x00C4,0x00C5,0x00C6,0x00C7, 0x00C8,0x00C9,0x00CA,0x00CB, 0x00CC,0x00CD,0x00CE,0x00CF,
|
||||
0x011E,0x00D1,0x00D2,0x00D3, 0x00D4,0x00D5,0x00D6,0x00D7, 0x00D8,0x00D9,0x00DA,0x00DB, 0x00DC,0x0130,0x015E,0x00DF,
|
||||
0x00E0,0x00E1,0x00E2,0x00E3, 0x00E4,0x00E5,0x00E6,0x00E7, 0x00E8,0x00E9,0x00EA,0x00EB, 0x00EC,0x00ED,0x00EE,0x00EF,
|
||||
0x011F,0x00F1,0x00F2,0x00F3, 0x00F4,0x00F5,0x00F6,0x00F7, 0x00F8,0x00F9,0x00FA,0x00FB, 0x00FC,0x0131,0x015F,0x00FF,
|
||||
};
|
||||
|
||||
uint16_t codetable_06[96] = {
|
||||
0x00A0,0x0104,0x0112,0x0122, 0x012A,0x0128,0x0136,0x00A7, 0x013B,0x0110,0x0160,0x0166, 0x017D,0x00AD,0x016A,0x014A,
|
||||
0x00B0,0x0105,0x0113,0x0123, 0x012B,0x0129,0x0137,0x00B7, 0x013C,0x0111,0x0161,0x0167, 0x017E,0x2015,0x016B,0x014B,
|
||||
0x0100,0x00C1,0x00C2,0x00C3, 0x00C4,0x00C5,0x00C6,0x012E, 0x010C,0x00C9,0x0118,0x00CB, 0x0116,0x00CD,0x00CE,0x00CF,
|
||||
0x00D0,0x0145,0x014C,0x00D3, 0x00D4,0x00D5,0x00D6,0x0168, 0x00D8,0x0172,0x00DA,0x00DB, 0x00DC,0x00DD,0x00DE,0x00DF,
|
||||
0x0101,0x00E1,0x00E2,0x00E3, 0x00E4,0x00E5,0x00E6,0x012F, 0x010D,0x00E9,0x0119,0x00EB, 0x0117,0x00ED,0x00EE,0x00EF,
|
||||
0x00F0,0x0146,0x014D,0x00F3, 0x00F4,0x00F5,0x00F6,0x0169, 0x00F8,0x0173,0x00FA,0x00FB, 0x00FC,0x00FD,0x00FE,0x0138,
|
||||
};
|
||||
|
||||
uint16_t codetable_07[96] = {
|
||||
0x00A0,0x0E01,0x0E02,0x0E03, 0x0E04,0x0E05,0x0E06,0x0E07, 0x0E08,0x0E09,0x0E0A,0x0E0B, 0x0E0C,0x0E0D,0x0E0E,0x0E0F,
|
||||
0x0E10,0x0E11,0x0E12,0x0E13, 0x0E14,0x0E15,0x0E16,0x0E17, 0x0E18,0x0E19,0x0E1A,0x0E1B, 0x0E1C,0x0E1D,0x0E1E,0x0E1F,
|
||||
0x0E20,0x0E21,0x0E22,0x0E23, 0x0E24,0x0E25,0x0E26,0x0E27, 0x0E28,0x0E29,0x0E2A,0x0E2B, 0x0E2C,0x0E2D,0x0E2E,0x0E2F,
|
||||
0x0E30,0x0E31,0x0E32,0x0E33, 0x0E34,0x0E35,0x0E36,0x0E37, 0x0E38,0x0E39,0x0E3A,0x0000, 0x0000,0x0000,0x0000,0x0E3F,
|
||||
0x0E40,0x0E41,0x0E42,0x0E43, 0x0E44,0x0E45,0x0E46,0x0E47, 0x0E48,0x0E49,0x0E4A,0x0E4B, 0x0E4C,0x0E4D,0x0E4E,0x0E4F,
|
||||
0x0E50,0x0E51,0x0E52,0x0E53, 0x0E54,0x0E55,0x0E56,0x0E57, 0x0E58,0x0E59,0x0E5A,0x0E5B, 0x0000,0x0000,0x0000,0x0000,
|
||||
};
|
||||
|
||||
uint16_t codetable_09[96] = {
|
||||
0x00A0,0x201D,0x00A2,0x00A3, 0x00A4,0x201E,0x00A6,0x00A7, 0x00D8,0x00A9,0x0156,0x00AB, 0x00AC,0x00AD,0x00AE,0x00C6,
|
||||
0x00B0,0x00B1,0x00B2,0x00B3, 0x201C,0x00B5,0x00B6,0x00B7, 0x00F8,0x00B9,0x0157,0x00BB, 0x00BC,0x00BD,0x00BE,0x00E6,
|
||||
0x0104,0x012E,0x0100,0x0106, 0x00C4,0x00C5,0x0118,0x0112, 0x010C,0x00C9,0x0179,0x0116, 0x0122,0x0136,0x012A,0x013B,
|
||||
0x0160,0x0143,0x0145,0x00D3, 0x014C,0x00D5,0x00D6,0x00D7, 0x0172,0x0141,0x015A,0x016A, 0x00DC,0x017B,0x017D,0x00DF,
|
||||
0x0105,0x012F,0x0101,0x0107, 0x00E4,0x00E5,0x0119,0x0113, 0x010D,0x00E9,0x017A,0x0117, 0x0123,0x0137,0x012B,0x013C,
|
||||
0x0161,0x0144,0x0146,0x00F3, 0x014D,0x00F5,0x00F6,0x00F7, 0x0173,0x0142,0x015B,0x016B, 0x00FC,0x017C,0x017E,0x2019,
|
||||
};
|
||||
|
||||
uint16_t codetable_0A[96] = {
|
||||
0x00A0,0x1E02,0x1E03,0x00A3, 0x010A,0x010B,0x1E0A,0x00A7, 0x1E80,0x00A9,0x1E82,0x1E0B, 0x1EF2,0x00AD,0x00AE,0x0178,
|
||||
0x1E1E,0x1E1F,0x0120,0x0121, 0x1E40,0x1E41,0x00B6,0x1E56, 0x1E81,0x1E57,0x1E83,0x1E60, 0x1EF3,0x1E84,0x1E85,0x1E61,
|
||||
0x00C0,0x00C1,0x00C2,0x00C3, 0x00C4,0x00C5,0x00C6,0x00C7, 0x00C8,0x00C9,0x00CA,0x00CB, 0x00CC,0x00CD,0x00CE,0x00CF,
|
||||
0x0174,0x00D1,0x00D2,0x00D3, 0x00D4,0x00D5,0x00D6,0x1E6A, 0x00D8,0x00D9,0x00DA,0x00DB, 0x00DC,0x00DD,0x0176,0x00DF,
|
||||
0x00E0,0x00E1,0x00E2,0x00E3, 0x00E4,0x00E5,0x00E6,0x00E7, 0x00E8,0x00E9,0x00EA,0x00EB, 0x00EC,0x00ED,0x00EE,0x00EF,
|
||||
0x0175,0x00F1,0x00F2,0x00F3, 0x00F4,0x00F5,0x00F6,0x1E6B, 0x00F8,0x00F9,0x00FA,0x00FB, 0x00FC,0x00FD,0x0177,0x00FF,
|
||||
};
|
||||
|
||||
uint16_t codetable_0B[96] = {
|
||||
0x00A0,0x00A1,0x00A2,0x00A3, 0x20AC,0x00A5,0x0160,0x00A7, 0x0161,0x00A9,0x00AA,0x00AB, 0x00AC,0x00AD,0x00AE,0x00AF,
|
||||
0x00B0,0x00B1,0x00B2,0x00B3, 0x017D,0x00B5,0x00B6,0x00B7, 0x017E,0x00B9,0x00BA,0x00BB, 0x0152,0x0153,0x0178,0x00BF,
|
||||
0x00C0,0x00C1,0x00C2,0x00C3, 0x00C4,0x00C5,0x00C6,0x00C7, 0x00C8,0x00C9,0x00CA,0x00CB, 0x00CC,0x00CD,0x00CE,0x00CF,
|
||||
0x00D0,0x00D1,0x00D2,0x00D3, 0x00D4,0x00D5,0x00D6,0x00D7, 0x00D8,0x00D9,0x00DA,0x00DB, 0x00DC,0x00DD,0x00DE,0x00DF,
|
||||
0x00E0,0x00E1,0x00E2,0x00E3, 0x00E4,0x00E5,0x00E6,0x00E7, 0x00E8,0x00E9,0x00EA,0x00EB, 0x00EC,0x00ED,0x00EE,0x00EF,
|
||||
0x00F0,0x00F1,0x00F2,0x00F3, 0x00F4,0x00F5,0x00F6,0x00F7, 0x00F8,0x00F9,0x00FA,0x00FB, 0x00FC,0x00FD,0x00FE,0x00FF,
|
||||
};
|
||||
|
||||
uint16_t *codetable_LUT[12] = {
|
||||
codetable_00,
|
||||
codetable_01,
|
||||
codetable_02,
|
||||
codetable_03,
|
||||
codetable_04,
|
||||
codetable_05,
|
||||
codetable_06,
|
||||
codetable_07,
|
||||
codetable_00,
|
||||
codetable_09,
|
||||
codetable_0A,
|
||||
codetable_0B,
|
||||
};
|
||||
|
||||
|
||||
|
||||
void en300468_parse_string_to_utf8(char *dest, const unsigned int destlen,
|
||||
uint8_t *src, const unsigned int len)
|
||||
{
|
||||
int utf8 = (src[0] == 0x15) ? 1 : 0;
|
||||
int skip = (src[0] < 0x20) ? 1 : 0;
|
||||
if( src[0] == 0x10 ) skip += 2;
|
||||
uint16_t utf8_cc;
|
||||
uint16_t *codetable = codetable_00;
|
||||
int encoding = 0;
|
||||
int skip = 0; // (src[0] < 0x20) ? 1 : 0;
|
||||
if( src[0] < 0x20 ) {
|
||||
encoding = src[0];
|
||||
if( encoding < 12 )
|
||||
codetable = codetable_LUT[encoding];
|
||||
skip = 1;
|
||||
}
|
||||
if( encoding == 0x1F ) {
|
||||
skip = 2;
|
||||
}
|
||||
if( encoding == 0x10 ) {
|
||||
if( src[1] == 0 ) {
|
||||
codetable = codetable_0B;
|
||||
if( src[1] == 0 && src[2] >= 5 && src[2] <= 15 ) {
|
||||
codetable = codetable_LUT[src[2] - 4];
|
||||
}
|
||||
}
|
||||
skip = 3;
|
||||
}
|
||||
uint32_t utf8_cc;
|
||||
int dest_pos = 0;
|
||||
int emphasis = 0;
|
||||
int i;
|
||||
|
||||
for (i = skip; i < len; i++) {
|
||||
switch(*(src + i)) {
|
||||
case SB_CC_RESERVED_80 ... SB_CC_RESERVED_85:
|
||||
case SB_CC_RESERVED_88 ... SB_CC_RESERVED_89:
|
||||
case SB_CC_USER_8B ... SB_CC_USER_9F:
|
||||
for (i = skip; i < len && dest_pos < destlen - 1; i++) {
|
||||
utf8_cc = *(src + i);
|
||||
if (utf8_cc >= 128 && encoding == 0x15 ) {
|
||||
if( (utf8_cc & 0xC0) == 0xC0 )
|
||||
{
|
||||
i++;
|
||||
utf8_cc &= 0x3F;
|
||||
if( utf8_cc & 0x20 ) utf8_cc &= 0x1F;
|
||||
if( utf8_cc & 0x10 ) utf8_cc &= 0x0F;
|
||||
if( utf8_cc & 0x08 ) utf8_cc &= 0x07;
|
||||
while( i < len && (*(src + i) & 0xC0) == 0x80 ) {
|
||||
utf8_cc = (utf8_cc << 6) | (*(src + i) & 0x3F);
|
||||
i++;
|
||||
}
|
||||
if( utf8_cc > 0x10FFFF )
|
||||
break; // UTF-8 error
|
||||
}
|
||||
else
|
||||
break; // UTF-8 error
|
||||
} else {
|
||||
if( encoding <= 0x10 && utf8_cc >= 0x80 && utf8_cc < 0xA0 )
|
||||
utf8_cc |= 0x0100;
|
||||
else if( utf8_cc >= 0xA0 ) {
|
||||
utf8_cc = codetable[utf8_cc-0xA0];
|
||||
}
|
||||
}
|
||||
|
||||
if( utf8_cc < 0xA0 ) {
|
||||
switch(utf8_cc) {
|
||||
case 0x01 ... 0x7F:
|
||||
dest[dest_pos++] = utf8_cc;
|
||||
break;
|
||||
case CHARACTER_CR_LF:
|
||||
dest[dest_pos++] = '\n';
|
||||
continue;
|
||||
break;
|
||||
case CHARACTER_EMPHASIS_ON:
|
||||
emphasis = 1;
|
||||
continue;
|
||||
break;
|
||||
case CHARACTER_EMPHASIS_OFF:
|
||||
emphasis = 0;
|
||||
continue;
|
||||
case UTF8_CC_START:
|
||||
if (utf8 == 1) {
|
||||
utf8_cc = *(src + i) << 8;
|
||||
utf8_cc += *(src + i + 1);
|
||||
|
||||
switch(utf8_cc) {
|
||||
case ((UTF8_CC_START << 8) | CHARACTER_EMPHASIS_ON):
|
||||
emphasis = 1;
|
||||
i++;
|
||||
continue;
|
||||
case ((UTF8_CC_START << 8) | CHARACTER_EMPHASIS_OFF):
|
||||
emphasis = 0;
|
||||
i++;
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
default: {
|
||||
if (*(src + i) < 128)
|
||||
dest[dest_pos++] = *(src + i);
|
||||
else {
|
||||
dest[dest_pos++] = 0xc2 + (*(src + i) > 0xbf);
|
||||
dest[dest_pos++] = (*(src + i) & 0x3f) | 0x80;
|
||||
if( dest_pos < destlen - 2 ) {
|
||||
dest[dest_pos++] = 0xC2;
|
||||
dest[dest_pos++] = (utf8_cc & 0x3F) | 0x80;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if( utf8_cc < 0x800 ) {
|
||||
if( dest_pos >= destlen - 2 )
|
||||
break;
|
||||
dest[dest_pos++] = 0xC0 | ((utf8_cc >> 6) & 0x1F);
|
||||
dest[dest_pos++] = (utf8_cc & 0x3F) | 0x80;
|
||||
} else if( utf8_cc < 0x10000 ) {
|
||||
if( dest_pos >= destlen - 3 )
|
||||
break;
|
||||
dest[dest_pos++] = 0xE0 | ((utf8_cc >> 12) & 0x0F);
|
||||
dest[dest_pos++] = ((utf8_cc >> 6) & 0x3F) | 0x80;
|
||||
dest[dest_pos++] = (utf8_cc & 0x3F) | 0x80;
|
||||
} else if( utf8_cc < 0x110000 ) {
|
||||
if( dest_pos >= destlen - 4 )
|
||||
break;
|
||||
dest[dest_pos++] = 0xF0 | ((utf8_cc >> 18) & 0x07);
|
||||
dest[dest_pos++] = ((utf8_cc >> 12) & 0x3F) | 0x80;
|
||||
dest[dest_pos++] = ((utf8_cc >> 6) & 0x3F) | 0x80;
|
||||
dest[dest_pos++] = (utf8_cc & 0x3F) | 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
dest[dest_pos] = '\0';
|
||||
}
|
||||
@ -1252,17 +1413,16 @@ static int sdt_cb(struct sfilter *sf)
|
||||
snl = buf[doff + 4 + spnl];
|
||||
s->pname[79] = 0x00;
|
||||
s->name[79] = 0x00;
|
||||
en300468_parse_string_to_utf8(s->pname, buf + doff + 4, spnl);
|
||||
en300468_parse_string_to_utf8(s->pname, sizeof(s->pname), buf + doff + 4, spnl);
|
||||
if( s->pname[79] != 0 )
|
||||
fprintf(stderr, "********************************************* PNAME OVERFLOW %d spnl = %d",spnl);
|
||||
en300468_parse_string_to_utf8(s->name, buf + doff + 5 + spnl, snl);
|
||||
en300468_parse_string_to_utf8(s->name, sizeof(s->name), buf + doff + 5 + spnl, snl);
|
||||
if( s->name[79] != 0 )
|
||||
fprintf(stderr, "********************************************* SNAME OVERFLOW %d snl = %d",snl);
|
||||
s->got_sdt = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1734,7 +1894,7 @@ static void print_events(struct tp_info *tpi)
|
||||
{
|
||||
struct service *s;
|
||||
struct event *e;
|
||||
char t[512];
|
||||
char t[768];
|
||||
int i;
|
||||
uint16_t y;
|
||||
uint8_t m,d;
|
||||
@ -1753,11 +1913,11 @@ static void print_events(struct tp_info *tpi)
|
||||
}
|
||||
printf(" LANG:%c%c%c\n", e->s_lang[0], e->s_lang[1], e->s_lang[2]);
|
||||
if( e->s_name ) {
|
||||
en300468_parse_string_to_utf8(t,&e->s_name[1],e->s_name[0]);
|
||||
en300468_parse_string_to_utf8(t,sizeof(t),&e->s_name[1],e->s_name[0]);
|
||||
printf(" NAME:%s\n",t);
|
||||
}
|
||||
if( e->s_text ) {
|
||||
en300468_parse_string_to_utf8(t,&e->s_text[1],e->s_text[0]);
|
||||
en300468_parse_string_to_utf8(t,sizeof(t),&e->s_text[1],e->s_text[0]);
|
||||
printf(" TEXT:%s\n",t);
|
||||
}
|
||||
printf("END\n");
|
||||
@ -1921,7 +2081,7 @@ void tpstring(struct tp_info *tpi, char *s, int slen)
|
||||
else
|
||||
len = snprintf(s, slen,
|
||||
"freq=%u&msys=dvbc&sr=%u&mtype=%s",
|
||||
tpi->freq, tpi->sr, mtype2str[tpi->mod]);
|
||||
pi->freq, tpi->sr, mtype2str[tpi->mod]);
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
|
Loading…
Reference in New Issue
Block a user