engine_web-ifc icon indicating copy to clipboard operation
engine_web-ifc copied to clipboard

[Bug]: After reading a text with special character '\X\80' becomes all texts with special characters unreadable

Open jespa007 opened this issue 6 months ago • 0 comments

What happened?

After reading a text with special character '\X\80' becomes all texts with special characters unreadable

I have created this IFC ISSUE_RVT22_WithSpecialValue.zip that has a PSET at line 145 with a text that contents the character '\X\80'.

Also I have created the following code in node that is runnable if is placed at directory tests\issues in order to reproduce the error. The code reads PSET at line 146 with a text with special characters in SPAIN and it reads fine. Then it reads a PSET with a text that contents the character '\X\80' and finally it reads again PSET 146 and all special characters that were read fine before now it turns unreadable.

const fs = require("fs");
const WebIFC = require('../../dist/web-ifc-api-node');

let newIfcAPI = new WebIFC.IfcAPI();

async function test(){
	await newIfcAPI.Init();

	const content = fs.readFileSync("../ifcfiles/public/ISSUE_RVT22_WithSpecialValue.ifc");

	let modelID = newIfcAPI.OpenModel(content);

	// 1. Read PSET at line #146 
	let line=newIfcAPI.GetLine(modelID,146);
	console.log("Parsed PSET value at line #146 :"+line.NominalValue.value + " -> Read speacial characters in SPAIN OK");

	// 2. Read PSET at linr #145 with special character  x80
	line=newIfcAPI.GetLine(modelID,145);
	console.log("Parsed PSET value at line #145 :"+line.NominalValue.value + " -> Reads special character x80 and ends with strange character");

	// 3. Try to read again PSET at line #146
	line=newIfcAPI.GetLine(modelID,146);
	console.log("Parsed PSET value at line #146 :" +line.NominalValue.value + " -> This time the special characters becomes unreadable now");

	newIfcAPI.CloseModel(modelID);
};

test();

The output is the following,

Parsed PSET value at line #146 :Válido, pestaña -> Read speacial characters in SPAIN OK
Parsed PSET value at line #146 :12888,43Ä -> Reads special character x80 and ends with strange character
Parsed PSET value at line #146 :V·lido, pestaÒa -> This time the special characters becomes unreadable now

Version

Latest

What browsers are you seeing the problem on?

No response

Relevant log output

Parsed PSET value at line #146 :Válido, pestaña -> Read speacial characters in SPAIN OK
Parsed PSET value at line #146 :12888,43Ä -> Reads special character x80 and ends with strange character
Parsed PSET value at line #146 :V·lido, pestaÒa -> This time the special characters becomes unreadable now

Anything else?

The IFC and code that reproduces the error is already attached

jespa007 avatar Aug 07 '24 07:08 jespa007