Skip to main content
Inspiring
November 16, 2022
Answered

FDK and cyrillic

  • November 16, 2022
  • 3 replies
  • 844 views

Hi all!

Here's a problem:

VoidT F_ApiInitialize(IntT init)
{
   F_FdeInit();
   F_ApiEnableUnicode(True);
   F_FdeInitFontEncs(ConStringT("UTF-8"));

   switch (init) {
   case FA_Init_First:
      F_ApiAlert(ConStringT("Всем низдрасти!!!"), FF_ALERT_CONTINUE_NOTE);
      break;
   }
}

In FM17 alert box is empty. Something wrong with cyrillic text in FDK?

    This topic has been closed for replies.
    Correct answer Andrei Bondarenko
    quote

    First, I had to convert your statement to a normal cast syntax, that is:

     

    F_ApiAlert((ConStringT)u8"Всем низдрасти!!!", FF_ALERT_CONTINUE_NOTE);

     

    Honestly, in modern C++ this convertion is not "normal". But nevertheless, thanks for the idea. I used this construct:

     

    F_ApiAlert(reinterpret_cast<ConStringT>(u8"Всѐм низдрӑсти!!!"), FF_ALERT_CONTINUE_NOTE);

     

     
     
     

    3 replies

    Legend
    November 18, 2022

    Hi,

     

    To begin, let me state clearly that I am no expert in the area of string encodings. But I did get this to work. I do not know if these steps will help you. I was working with VS2019 and FM2020.

     

    First, I had to convert your statement to a normal cast syntax, that is:

     

     

    F_ApiAlert((ConStringT)"Всем низдрасти!!!", FF_ALERT_CONTINUE_NOTE);

     

     

    I don't know if you have something special going on that I don't understand or if that was a typo, but either way, it's what I had to do.

     

    Then, when I put that alert statement into the code of one of my plugins, all of which are unicode-enabled, VS2019 gave me this warning when I tried to save the file:

     

    I clicked yes to allow the conversion.

     

    Then, when I tried to compile, I got a compiler warning for each character in the string, something like:

     

     

    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u0412' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u0441' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u0435' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u043C' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u043D' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u0438' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u0437' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u0434' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u0440' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u0430' cannot be represented in the current code page (1252)
    1>C:\WestStreet\Development\WS_Utils_VC9\WS_Utils_VC9\wsu_Main.c(2401,26): warning C4566: character represented by universal-character-name '\u0442' cannot be represented in the current code page (1252)

     

     

     

    ...and the popup showed unknown characters, for example:

     

    So then I googled the compiler warnings and read some stuff that I didn't really understand, but I at least found the idea to do this:

     

     

    F_ApiAlert((ConStringT)u8"Всем низдрасти!!!", FF_ALERT_CONTINUE_NOTE);

     

     

     

    ...and now it works:

     

    I don't know if this will help you. Hope it does.

    Russ

     

     

     

     

     

     

     

     

     

     

     

    Bob_Niland
    Community Expert
    Community Expert
    November 18, 2022

    The "code page" warning, and the need for that "u8" in the F_ApiAlert call syntax suggests that the call is by default Latin1 code space only (00h-FFh), and has to be told to use Unicode.

    K.Daube
    Community Expert
    Community Expert
    November 17, 2022

    I also have no experience with FDK, just tried with ExtendScript

    Console ("Всем низдрасти!!!"); // Hello Everyone

    In the console I see this correctly in FM-15 (2029). But I have no clue what the font is in this window. My Windows Dialogue font seems to be Segoe UI.

    Bob_Niland
    Community Expert
    Community Expert
    November 16, 2022

    empty (no content at all), or string of spaces?

     

    I've never worked with FDK, but my first thought is:
    what is the console font, and does it populate those cyrillic code points?