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 #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;
oss.put(ch); if (within_spf_range) {
if ( ch == '\\' || ch == '\'' ) {
oss.put(ch);
}
oss.put(ch);
} else {
oss.put('_');
}
} }
#endif #endif
oss.put('\''); oss.put('\'');