Home AMX User Forum AMX Technical Discussion

Unicode issue

Dear All,
I'm getting some data from internet radio through a media server which supports TuneIn service, but some characters are coming back on my language ( not English ) and do not appear as expected on my touch panel ( they appear as symbols ) although I have selected fonts that support my language.

Below you can see how how they appear on N2S notifications (lines 457,458,465, and 466)

Can I make any kind of conversion?

Line 453 2021-03-14 (00:49:59):: String To [33001:5:1]-[ReportState Player_A MetaData1=TuneIn: Melodia FM 99.2 (Top 40 & Pop Music)]
Line 454 2021-03-14 (00:49:59):: String From [33001:5:1]-[ReportState Player_A MetaData1=TuneIn: Melodia FM 99.2 (Top 40 & Pop Music)]
Line 455 2021-03-14 (00:49:59):: String To [33001:5:1]-[ReportState Player_A MetaLabel2=Artist]
Line 456 2021-03-14 (00:49:59):: String From [33001:5:1]-[ReportState Player_A MetaLabel2=Artist]
Line 457 2021-03-14 (00:49:59):: String To [33001:5:1]-[ReportState Player_A MetaData2=$CE$93$CE$99$CE$A9$CE$A1$CE$93$CE$9F$CE$A3 $CE$96$CE$91$CE$9C$CE$A0$CE$95$CE$A4$CE$91$CE$A3]
Line 458 2021-03-14 (00:49:59):: String From [33001:5:1]-[ReportState Player_A MetaData2=$CE$93$CE$99$CE$A9$CE$A1$CE$93$CE$9F$CE$A3 $CE$96$CE$91$CE$9C$CE$A0$CE$95$CE$A4$CE$91$CE$A3]
Line 459 2021-03-14 (00:49:59):: String To [33001:5:1]-[ReportState Player_A MetaLabel3=Album]
Line 460 2021-03-14 (00:49:59):: String From [33001:5:1]-[ReportState Player_A MetaLabel3=Album]
Line 461 2021-03-14 (00:49:59):: String To [33001:5:1]-[ReportState Player_A MetaData3=Top 40 & Pop Music]
Line 462 2021-03-14 (00:49:59):: String From [33001:5:1]-[ReportState Player_A MetaData3=Top 40 & Pop Music]
Line 463 2021-03-14 (00:49:59):: String To [33001:5:1]-[ReportState Player_A MetaLabel4=Track]
Line 464 2021-03-14 (00:49:59):: String From [33001:5:1]-[ReportState Player_A MetaLabel4=Track]
Line 465 2021-03-14 (00:49:59):: String To [33001:5:1]-[ReportState Player_A MetaData4=$CE$A7$CE$99$CE$9B$CE$99$CE$91 $CE$A0$CE$95$CE$A1$CE$99$CE$A3$CE$A4$CE$95$CE$A1$CE$99$CE$91]
Line 466 2021-03-14 (00:49:59):: String From [33001:5:1]-[ReportState Player_A MetaData4=$CE$A7$CE$99$CE$9B$CE$99$CE$91 $CE$A0$CE$95$CE$A1$CE$99$CE$A3$CE$A4$CE$95$CE$A1$CE$99$CE$91]

Any ideas please?

Thanks,
George

Comments

  • Don't know what you have done at this moment, but have you read the uncode section in the help?
    just asking.

  • yes, I have read it...
    supposing that these characters are on UTF-8 format and should be converted to ASCII, I tried the below:

    data_event[vdvMCS1] //media server
    {
    string:
    {
    stack_var char iData[500];
    local_var char iUTF8[500];
    local_var char iASCII[500];

                iData = data.text;
    
                if (find_string(iData,'ReportState Player_A MetaData4=',1))
                        {
                                remove_string(iData,'=',1);
                                                    iUTF8   = wc_decode(iData,WC_FORMAT_UTF8,1);  //Line 387
                                                iASCII = wc_encode(iUTF8,WC_FORMAT_ASCII,1);    / /Line 388
                        }
        }
    

    }

    The above cannot be compiled:

    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(387): C10585: Dimension mismatch: [0] vs. [1]
    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(387): C10533: Illegal assignment statement
    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(388): C10585: Dimension mismatch: [1] vs. [0]
    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(388): C10555: Type mismatch in call for parameter [WCDATA]

    I have also included the "UnicodeLib.axi"

  • yes I have read it...

    supposing that these characters are in UTF-8 format and should be converted to ASCII ones, I tried the below:

    data_event[vdvMCS1]
    {
    string:
    {
    stack_var char iData[500];
    local_var char iUTF8[500];
    local_var char iASCII[500];

                iData = data.text;
    
                if (find_string(iData,'ReportState Player_A MetaData4=',1))
                        {
                                remove_string(iData,'=',1);
                                iUTF8   = wc_decode(iData,WC_FORMAT_UTF8,1); //Line 387
                                iASCII = wc_encode(iUTF8,WC_FORMAT_ASCII,1);   //Line 388
                        }
        }
    

    }

    The above cannot be compiled:

    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(387): C10585: Dimension mismatch: [0] vs. [1]
    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(387): C10533: Illegal assignment statement
    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(388): C10585: Dimension mismatch: [1] vs. [0]
    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(388): C10555: Type mismatch in call for parameter [WCDATA]

    I have also included the "UnicodeLib.axi"

  • Seems like Greek encoded as UTF-8:

    https://utf8-chartable.de/unicode-utf8-table.pl?start=768

    The dimension mismatch probably comes from using a 'char' instead of a 'widechar' for iUTF8
    Also presume you have set the editor and compiler options for unicode in the preferences?

  • yes I have read it...

    supposing that these characters are in UTF-8 format and should be converted to ASCII ones, I tried the below:

    data_event[vdvMCS1]
    {
    string:
    {
    stack_var char iData[500];
    local_var char iUTF8[500];
    local_var char iASCII[500];

                iData = data.text;
    
                if (find_string(iData,'ReportState Player_A MetaData4=',1))
                        {
                                remove_string(iData,'=',1);
                                iUTF8   = wc_decode(iData,WC_FORMAT_UTF8,1); //Line 387
                                iASCII = wc_encode(iUTF8,WC_FORMAT_ASCII,1);   //Line 
                        }
        }
    

    }

    The above cannot be compiled:

    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(387): C10585: Dimension mismatch: [0] vs. [1]
    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(387): C10533: Illegal assignment statement
    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(388): C10585: Dimension mismatch: [1] vs. [0]
    ERROR: C:\Users\George\Desktop\Modules\Autonomic AMX Module\Autonomic Controls MCS Main.axs(388): C10555: Type mismatch in call for parameter [WCDATA]

    I have also included the "UnicodeLib.axi"

  • yes, this is Greek UTF-8 and should be converted to ASCII.

    On regards to dimension mismatch I have used both 'char; and 'widechar' with no success.

    Also, editor and compiler options have been set for unicode in the preferences

Sign In or Register to comment.