Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lcftrans/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ std::string Utils::LowerCase(const std::string& in) {
}

std::string Utils::RemoveControlChars(std::string_view s) {
// RPG_RT ignores any control characters within messages.
// RPG_RT ignores C0 control characters (0x00-0x1F) within messages.
// Keep DEL (0x7F) because some games use it as a meaningful message prefix.
std::string out = lcf::ToString(s);
auto iter = std::remove_if(out.begin(), out.end(), [](const char ch) { return (ch >= 0x0 && ch <= 0x1F) || ch == 0x7F; });
auto iter = std::remove_if(out.begin(), out.end(), [](const char ch) { return ch >= 0x0 && ch <= 0x1F; });
out.erase(iter, out.end());
return out;
}
Expand Down