View Issue Details

IDProjectCategoryView StatusLast Update
0027100Open CASCADEOCCT:Foundation Classespublic2016-01-22 20:09
ReporteradvAssigned Toabv 
PrioritynormalSeverityminor 
Status closedResolutionno change required 
PlatformLinuxOSRHEL 
Product Version6.3.1 
Summary0027100: OSD_Path missing constructor accepting path parameter as TCollection_ExtendedString
DescriptionOSD_Path supports paths containing Unicode symbols since 26514 issue implementation, it’ll be quite useful to have constructor accepting path parameter as TCollection_ExtendedString.

Currently, having no this constructor user forced to convert the path to TCollection_AsciiString in order to create OSD_Path instance. In turn TCollection_AsciiString has constructor accepting TCollection_ExtendedString as input parameter and surely any user will use this fairly easy conversion approach, however, this approach is not acceptable for paths and will cause an inside OSD_Path error due to specific TCollection_AsciiString conversion method, instead it is essential to use ToUTF8CString() conversion method of TCollection_ExtendedString to make correct UTF-8 encoded string.

As this approach is incomprehensible and nowhere documented, OSD_Path should implement constructor accepting path parameter as TCollection_ExtendedString and internally convert it to TCollection_AsciiString by the proper way making utilization of Unicode paths totally transparent to the user.

Additional information
and documentation updates
WNT platforms has no need to make such special conversion through ToUTF8CString() method, instead it’s just enough TCollection_AsciiString constructor.
TagsNo tags attached.
Test case number

Relationships

child of 0026514 closedbugmaster OSD_Path can not work with French symbols in file name. 

Activities

abv

2016-01-22 18:35

manager   ~0050075

Alexey, in OCCT 7.0 constructor of TCollection_AsciiString from TCollection_ExtendedString with default second argument (0) will convert string to UTF-8 encoding using method ToUTF8CString() of the argument. This seems to be exactly what is needed, is that correct? If so, we seem to need nothing to do.

adv

2016-01-22 19:37

developer   ~0050082

Andrey,

Seems yes, but not at all, I suppose further issue discussions are applicable for applications working in conjunction with Qt framework.

So, to pass data from QString to TCollection_ExtendedString, when dealing with paths containing non-ascii symbols, we’ve found out that one cannot use the same approach for both Linux and WNT. Here is the internally developed macro called ‘QStringToCString’ we using for conversion QString to characters array:

#ifdef WNT
#define QStringToCString( src ) src.toLatin1().constData()
#else
#define QStringToCString( src ) src.toUtf8().constData()
#endif

As it can be seen from the code WNT platform using Latin1 method and Linux Utf8, methods transposition gives not acceptable conversion - perhaps it’s due to Qt internal issues.

Consequently in order to properly convert TCollection_ExtendedString to TCollection_AsciiString, and then pass it to OSD_Path constructor, on Linux platforms it is essential to use ToUTF8CString() and on WNT just usual TCollection_AsciiString constructor with nonzero second argument.

abv

2016-01-22 19:47

manager   ~0050083

These troubles should be pertinent only for older OCCT versions, can you clarify if you experienced this with OCCT 6.9.x or 7.0, or earlier?

adv

2016-01-22 19:52

developer   ~0050084

Indeed in our case the problem comes from the Qt side and not OCC, so like when using toUtf8() method of QString on WNT we’re getting corrupted characters array.

abv

2016-01-22 20:09

manager   ~0050086

I am closing the issue since as we discussed current OCCT is believed to work fine with UTF8 encoding on all platforms

Issue History

Date Modified Username Field Change
2016-01-21 11:01 adv New Issue
2016-01-21 11:01 adv Assigned To => abv
2016-01-21 11:06 adv Relationship added child of 0026514
2016-01-21 12:47 abv Target Version Unscheduled => 7.0.0
2016-01-22 18:35 abv Note Added: 0050075
2016-01-22 18:35 abv Assigned To abv => adv
2016-01-22 18:35 abv Status new => feedback
2016-01-22 19:37 adv Note Added: 0050082
2016-01-22 19:37 adv Assigned To adv => abv
2016-01-22 19:37 adv Status feedback => assigned
2016-01-22 19:47 abv Note Added: 0050083
2016-01-22 19:52 adv Note Added: 0050084
2016-01-22 20:09 abv Note Added: 0050086
2016-01-22 20:09 abv Status assigned => closed
2016-01-22 20:09 abv Resolution open => no change required
2016-01-22 20:09 abv Target Version 7.0.0 =>