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

Create an UTF-8 API_TextType element

Anonymous
Not applicable
Hi!

I've recently been struggling with utf-8 encoding in Archicad :
I am trying to create a Text Element in the scene, but my text is UTF8. I tried converting the text, playing around with GS::UniString and the CH family of functions, but so far nothing worked.

I even wonder if it is actually possible, as the API_ElementMemo->textContent is just a pointer to char * ? I am not experienced at all with encoding issues, so any help is welcome !

Thanks !
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Anonymous
Not applicable
Alright, it was easy once I got a little less ArchiCAD specific in my searches, I feel ashamed !

It is as simple as declaring your strings as
std::string str = u8"Whatever you want to input àéï" ;
, and work done, the u8 before your string does all the work, no need for a GS::Unistring or anything else.

Hope it will help someone !

View solution in original post

1 REPLY 1
Solution
Anonymous
Not applicable
Alright, it was easy once I got a little less ArchiCAD specific in my searches, I feel ashamed !

It is as simple as declaring your strings as
std::string str = u8"Whatever you want to input àéï" ;
, and work done, the u8 before your string does all the work, no need for a GS::Unistring or anything else.

Hope it will help someone !