xBimTeam / XbimEssentials

A .NET library to work with data in the IFC format. This is the core component of the Xbim Toolkit
https://xbimteam.github.io/
Other
485 stars 172 forks source link

Encoding string #505

Open BIM4SmartHydropower opened 1 year ago

BIM4SmartHydropower commented 1 year ago

Hi, everyone.

XbimP21StringDecoder.cs provides a string decoder for IFC. If I want to write some words with string encoding using Xbim, is there some existed classes could be used for it?

https://github.com/xBimTeam/XbimEssentials/blob/master/Xbim.Common/Step21/XbimP21StringDecoder.cs

martin1cerny commented 1 year ago

The Toolkit will handle the encoding for you. When you set any string attribute of any IFC entity in code, we will apply the right encoding. If you read it, we will apply the right decoding. So, you can just work with Unicode C# strings.

The class used for encoding/serialization is this: https://github.com/xBimTeam/XbimEssentials/blob/5c3f8423cfd6d7471fa6f1b7a688570d91b6aa23/Xbim.Common/Step21/StepTextHelper.cs#L24

Do you have any special use case where you need to apply encoding/decoding outside of our parsers and serializers?