Archicad C++ API
About Archicad add-on development using the C++ API.

Get the names of layouts at Cyrillic

Anonymous
Not applicable
Hi!
I try to receive names of layouts at Cyrillic (Russian & Ukrainian symbols), but when i output names to "Session Reporter", I receive garbage like
@825B.

Look attachment for more information.
1 - Layouts names at "Navigator - Layout Book"
2 - Output to "Session Reporter"

Look at my code here: http://pastebin.com/eHEGCT0g

Advance thanks

attach.png
2 REPLIES 2
ReignBough
Enthusiast
Does "Session Reporter" supports UNICODE?

Have you tried using OutputDebugStringW() and _swprintf() instead of ACAPI_WriteReport()?
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

The name has unicode characters (GS::uchar_t), but you casted them to normal characters (char). That's why you lost cyril symbols and get garbage.

Instead of this code:
char* name = new char[API_UniLongNameLen];   
for(GSIndex i = 0; i < API_UniLongNameLen; i++)   
{   
        name = (char)(api_dbPars.name);   
        if((char)api_dbPars.name == '\0') { break; }   
}   
ACAPI_WriteReport((char*)(name), false);   
delete[] name;


Please use the following:
GS::UniString name (api_dbPars.name);   
ACAPI_WriteReport(name.ToCStr ().Get (), false);


It's much shorter and works great. 😉

Best Regards,
Tibor Lorántfy

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!