When built without ICU filter characters outside of unencoded range

This commit is contained in:
aothms
2015-08-14 22:11:32 +02:00
parent 810d3eab1e
commit 3cba242295
+8 -1
View File
@@ -352,9 +352,16 @@ IfcCharacterEncoder::operator std::string() {
#else #else
for (std::string::const_iterator i = str.begin(); i != str.end(); ++i) { for (std::string::const_iterator i = str.begin(); i != str.end(); ++i) {
char ch = *i; char ch = *i;
if ( ch == '\\' || ch == '\'' ) oss.put(ch); const bool within_spf_range = ch >= 0x20 && ch <= 0x7e;
if (within_spf_range) {
if ( ch == '\\' || ch == '\'' ) {
oss.put(ch); oss.put(ch);
} }
oss.put(ch);
} else {
oss.put('_');
}
}
#endif #endif
oss.put('\''); oss.put('\'');
return oss.str(); return oss.str();