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
+9 -2
View File
@@ -352,8 +352,15 @@ IfcCharacterEncoder::operator std::string() {
#else
for (std::string::const_iterator i = str.begin(); i != str.end(); ++i) {
char ch = *i;
if ( ch == '\\' || ch == '\'' ) oss.put(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);
} else {
oss.put('_');
}
}
#endif
oss.put('\'');