buildingSMART / buildingSMART/IFC4.x-development
Should string data types restrict character usage?
- Dominant language
- Python
- Stars
- 234
- Forks
- 123
- Avg merge
- 15h 4m
- Merged PRs (30d)
- 5
Description
Originally posted here: https://forums.buildingsmart.org/t/non-printable-characters-in-ifc-string-data-types/3497
In short, yes in STEP I can put all sorts of fun stuff, but should IFC have a say in this? Should we, for example, say that IfcText can contain line breaks and other non printable characters, but IfcIdentifier cannot include linebreaks or non printable characters?
Original post quoted:
IFC offers a variety of string-based data types. For example, `IfcText` and `IfcIdentifier`. As a human, I would only expect things like line breaks to be accepted in `IfcText`, and things like `IfcIdentifier` should not. Yet, they both offer the exact same description:
> NOTE The set of characters that may appear in STRINGs exchanged in the exchange structure as defined in ISO 10303.21 is provided in ISO 10646. The encoding of characters in case of file-based exchange is defined in ISO 10303-21 and ISO 10303-28. Among else, these specifications define the encoding of 8-bit characters from ISO 8859-1...-16 and of 2-byte and 4-byte Unicode characters from ISO 10646.
Here is an IfcWall with a tab and line break encoded in its name attribute:
```
#1=IFCWALL($,$,'asdf\\X2\\0009\\X0\\asdf\\X2\\000A\\X0\\asdf',$,$,$,$,$,$);
```
For clarification - this question is about what set of characters should be allowed in the IFC string data types. _Not_ about the capabilities of STEP-based encoding, which is irrelevant (but, really, really fun!)
As another example, we can name our walls after cat emojis. Nice.
```
>>> w
#1=IfcWall($,$,'Miao 😸',$,$,$,$,$,$)
>>> f.wrapped_data.to_string()
"...#1=IFCWALL($,$,'Miao \\X4\\0001F638\\X0\\',$,$,$,$,$,$);..."
```
I _think_ this is legal, but should it be?
Contributor guide
Assessment
This issue has not been assessed yet.