Is there a way to get the currently used character set and character encoding from the Revit API?(2016 or more)

Is there a way to get the currently used character set and character encoding from the Revit API?(2016 or more)

550865615
Participant Participant
711 Views
3 Replies
Message 1 of 4

Is there a way to get the currently used character set and character encoding from the Revit API?(2016 or more)

550865615
Participant
Participant

For simplified Chinese processing, my plugin always has no exceptions.

 

But when I worked with the following model, I found that its various names (for example, view names) were all in Vietnamese.

 

Then, the exception thrown comes from not correctly transcoding the Vietnamese string.

 

So,is there a way to get the currently used character set and character encoding from the Revit API?Or how can I 

convert characters correctly?

550865615_0-1615446466385.png

 

0 Likes
Accepted solutions (1)
712 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

Your Revit add-in is a .NET framework plugin. It plugs into the Revit.exe process. You should be able to use standard Windows and .NET functionality to determine the required information from that process. The Revit API does not include any additional functionality in this area.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 4

550865615
Participant
Participant
Thanks for your answer,jeremy.
My plug-in calls an unmanaged C ++ library, and the exception occurs when a managed string is converted to an unmanaged string.
Isn't there any other way?
0 Likes
Message 4 of 4

jeremy_tammik
Alumni
Alumni
Accepted solution

Sure there are other ways, and they all have nothing whatsoever to do with the Revit API.

 

https://duckduckgo.com/?q=convert+string+managed+unmanaged+C%2B%2B

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes