window: add ScopedStringHelper and use it where appropriate