DMR: Fix UTF16 Talker Alias locale to allow Chinese or similar Non-Roman Charsets;

Note: This will only work to the console output, since ncurses wide chars are different. The alias string will replace extended utf16 chars with an * for now.
This commit is contained in:
lwvmobile
2025-07-14 06:15:55 -04:00
parent 8c34313720
commit 352bb98bc6

View File

@@ -794,30 +794,25 @@ void dmr_talker_alias_lc_decode (dsd_opts * opts, dsd_state * state, uint8_t slo
}
else if (char_size == 16)
{
setlocale(LC_ALL, ""); //needed when encoded alias contains Chinese (or probably any non-roman charset that isn't default on users terminal)
for (i = 0; i < end; i++)
{
uint16_t character = (uint16_t)ConvertBitIntoBytes(&state->dmr_pdu_sf[slot][(i*16)], 16);
char ch[2]; ch[0] = character & 0xFF; ch[1] = 0;
// if (character >= 0x20 && character <= 0x7E) //Standard ASCII Set //may see what happens if this is disabled
if (character >= 0x20 && character != 0x7F) //will want to next, but should be okay (unless RAS or CRC Bypass)
{
if (character >= 0x20 && character != 0x7F)
fprintf (stderr, "%lc", character);
strcat (alias_string, ch);
}
// else if (character == 0)
// {
// strcat (alias_string, " ");
// fprintf (stderr, " ");
// break;
// }
else
{
else fprintf (stderr, " ");
if (character == 0)
strcat (alias_string, " ");
fprintf (stderr, " ");
}
else if (character >= 0x20 && character <= 0xFE)
strcat (alias_string, ch);
else
strcat (alias_string, "*");
//debug
// fprintf (stderr, " %04X, ", character);
// fprintf (stderr, " [%04X], ", character);
}
}