Home AMX User Forum NetLinx Studio
Options

Russian text to touchpanel

Hi AMX group.

My name is Gary and I've recently joined this group and have been reading through many of the posts.
Very interesting group.
I'm still a relative newcomer to AMX/Netlinx so please bear with me.
I'm sure this will be the first of many questions.

I'm trying to get my head around this whole unicode thing with netlinx so please be gentle with me :)

For the time being I have created an include file that defines a CHAR array such:
CHAR zoneRussianTemplate[30][7][30] =
{
{'Sat1', '2', '31', '2', '1', 'английский|Спутниковое', 'английский Спутниковое'},
{'Sat2', '2', '32', '2', '1', 'Русский|Спутниковое', 'Русский Спутниковое' },
etc etc
{'Blinds', '3', '26', '1', '1', 'Занавески', 'Занавески' }
}

The last two columns in the array is the text to be sent to the panels.

I've been caught with this one before with C******n, so I selected an Arial font that I knew supported Cyrillic.
(By the way - love the way that got changed to ******** - very funny.)

If I send the first row, column 7 text to the panel:
SEND_COMMAND TP1,"'!T',1, zoneRussianTemplate[1][7]"
This just printed a load of garbage characters on the panel.

I then tested if I could send this as unicode so:
I pasted 'английский Спутниковое' as unicode and tried:
SEND_COMMAND TP1,"'^UNI-1,1,0430043D0433043B043804390441043A0438043900200421043F04430442043D0438043A043E0432043E0435'"
This worked and displayed as expected.

The plan ultimately is to replace the array with a text file in the processor and read that in. So I'd like to keep the text in Russian.
That way we can get a list of Russian devices or settings from the clients and load these straight to the panel.

So how can I get Russian text to display on the panel?
I mean how do they do this in Russia?

I have included INCLUDE 'UnicodeLib.axi' in my program and have enabled the _WC Preprocessor (Unicode) in settings. (Although I've yet to fully understand this)

Incidentally for those who may have spotted the '|' before the word 'Спутниковое' in column 6, and wondering what it does - this is a special character that creates a carriage return in the array text. Many thanks to AMX UK for that one.

Any help greatly appreciated.

Thanks

gary

Comments

  • Options
    mpullinmpullin Posts: 949
    sorry, couldn't resist

    In Soviet Russia, Panel SENDS_COMMAND to you.
  • Options
    slip couganslip cougan Posts: 34
    Now thats funny.

    Now I know why it dosn't work! :)
  • Options
    yuriyuri Posts: 861
    have you tried using the WC_TP_ENCODE function?
    i have NO idea if this is any good, but it looks promising :)
    WC_TP_ENCODE
    This function encodes a WIDECHAR array into a CHAR array formatted for the UNI and BAU user interface commands.

    CHAR[ ] WC_TP_ENCODE (WIDECHAR STRING[ ])

    Parameters:

    STRING: The widechar string to send to a user interface.

    The result is an encoded character string.

    cString = WC_TP_ENCODE(wcSTRING)

    SEND_COMMAND dvTY,??^UNI-1,0,?,cString?
  • Options
    slip couganslip cougan Posts: 34
    Thanks for the response Yuri,

    There appears to be an issue with WIDECHAR formatting:

    I have experimented defining the Russian text as a WIDECHAR but this just gives me a compile error even if I enclose it in the _WC() macro.
    Although the help file on WIDECHAR states that CHAR & WIDECHAR text can be treated the same, they cannot, for example:
    I can store the Russian text in a CHAR:
    CHAR MyString[] = 'английский Спутниковое' no problem.

    I can't store it in a WIDECHAR:
    WIDECHAR wcMyString[] = 'английский Спутниковое'
    That just throws a compile WARNING: D:\...\Touchpanel control setup.axi(89): C10571: Converting type [string] to [WIDECHAR]

    If I enclose it in the _WC macro:
    WIDECHAR wcMyString[] = _WC('английский Спутниковое')
    Then I get a syntax error.

    Yet this:
    WIDECHAR wcMyString[] = _WC('my string')
    Compiles OK.

    I currently have AMX looking into this as well as I'm stumped on this.

    regards

    g
  • Options
    yuriyuri Posts: 861
    what if you pass your Russian text in a CHAR
    CHAR MyString[] = 'английский Спутниковое' no problem.

    and then pass that CHAR to WC_TP_ENCODE()?
    I know it will probably not work, but i dont have a TP at hand, so i can't test it for myself :)
Sign In or Register to comment.