<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Special Characters turn into ??? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Special-Characters-turn-into/m-p/369820#M1390</link>
    <description>&lt;P&gt;Well, I found a solution...&lt;/P&gt;&lt;P&gt;Turns out my csv-File wasn't utf-8. After exporting my csv to utf-8, it worked like a charm.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Feb 2023 14:01:24 GMT</pubDate>
    <dc:creator>Dayiz</dc:creator>
    <dc:date>2023-02-06T14:01:24Z</dc:date>
    <item>
      <title>Special Characters turn into ???</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Special-Characters-turn-into/m-p/369809#M1389</link>
      <description>&lt;P&gt;Hello dear Graphisoft Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently writing an AddOn to rename layouts, but im getting trouble with special characters.&lt;/P&gt;&lt;P&gt;We work in german and special chars like "äöüß" are part of our projects.&lt;/P&gt;&lt;P&gt;To rename the layouts, i read from a csv file the old and new ref and name (&lt;A href="https://archicadapi.graphisoft.com/documentation/api_windowinfo" target="_blank" rel="noopener"&gt;https://archicadapi.graphisoft.com/documentation/api_windowinfo&lt;/A&gt;&amp;nbsp;for reference) and rename if i find a match. This part works fine, but as soon as a layout consists of special charaters, everything goes bad:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ForumThread.PNG" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/34099iFD57AFB1E837657C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ForumThread.PNG" alt="ForumThread.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is how the data looks after reading it from the .csv (i read the file with fstream and every string is saved as std::string inside a vector). Everytime there is a special characters, I only get ????????.&lt;/P&gt;&lt;P&gt;This also stays after renaming the layouts:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="layouts.PNG" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/34100i667ADA194B48EE78/image-size/medium?v=v2&amp;amp;px=400" role="button" title="layouts.PNG" alt="layouts.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But as you can see, special characters work just fine (like Ü).&lt;BR /&gt;&lt;BR /&gt;So I'm not sure what causes the behavior, most likely it is how I convert std::string to GS::uchar_t&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried (note -&amp;nbsp;csvInfos[ev.GetListItem() - 1] returns a std::string):&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;P&gt;str1 = GS::UniString(std::get&amp;lt;0&amp;gt;(csvInfos[ev.GetListItem() - 1]).c_str(), CC_UTF8)&lt;/P&gt;&lt;P&gt;str1 = tb.ToUniString(tb.StringToWString(std::get&amp;lt;2&amp;gt;(csvInfos[ev.GetListItem() - 1])))&lt;/P&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;(from&amp;nbsp;&lt;A href="https://community.graphisoft.com/t5/Developer-forum/Convert-from-GS-UniString-to-std-string/td-p/306967" target="_blank" rel="noopener"&gt;https://community.graphisoft.com/t5/Developer-forum/Convert-from-GS-UniString-to-std-string/td-p/306967&lt;/A&gt;)&lt;BR /&gt;and some other things, which didn't work.&lt;/P&gt;&lt;P&gt;The above code was for displaying the old and new values in a list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the renaming part I tried the same things as for the list and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;GS::ucsncpy(dbi.name, GS::UniString(std::get&amp;lt;3&amp;gt;(layoutCsvInfos[i]).c_str(), CC_UTF8).ToUStr(), API_UAddParStrLen - 1);&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But nothing works.&lt;/P&gt;&lt;P&gt;Can anyone give me a tip on how to work with special characters in ArchiCAD or how I can properly convert std::string to GS::uchar_t?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 13:07:45 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Special-Characters-turn-into/m-p/369809#M1389</guid>
      <dc:creator>Dayiz</dc:creator>
      <dc:date>2023-02-06T13:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Special Characters turn into ???</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Special-Characters-turn-into/m-p/369820#M1390</link>
      <description>&lt;P&gt;Well, I found a solution...&lt;/P&gt;&lt;P&gt;Turns out my csv-File wasn't utf-8. After exporting my csv to utf-8, it worked like a charm.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 14:01:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Special-Characters-turn-into/m-p/369820#M1390</guid>
      <dc:creator>Dayiz</dc:creator>
      <dc:date>2023-02-06T14:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Special Characters turn into ???</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Special-Characters-turn-into/m-p/369823#M1391</link>
      <description>&lt;P&gt;Hi, i am from Brazil and i went through something really similar when trying to write strings like "construção", "métodos", etc. I solved it by using a GS::UniString object with the macro L( ) inside it. Something like this:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;GS::UniString name {L("Construção")}; // Ok
GS::UniString name_2 {"Construção"}; // Results in ??????????&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this solution in some of the SDK examples. I don't know if the special characters you mentioned will work with this method, but you can give it a shot.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 14:13:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Special-Characters-turn-into/m-p/369823#M1391</guid>
      <dc:creator>Leonardo Lopes</dc:creator>
      <dc:date>2023-02-06T14:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Special Characters turn into ???</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Special-Characters-turn-into/m-p/370270#M1392</link>
      <description>&lt;P&gt;Hey, thanks for the suggestion, but&amp;nbsp; this method doesn't work for me since i don't know the strings during compile time and you can't do things like {u8(stringVariable)}&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 11:47:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Special-Characters-turn-into/m-p/370270#M1392</guid>
      <dc:creator>Dayiz</dc:creator>
      <dc:date>2023-02-10T11:47:15Z</dc:date>
    </item>
  </channel>
</rss>

