SQLite Forum

new PP #define, SQLITE_REPLACE_INVALID_UTF
Login
I see that the newly-introduced compile-time option, SQLITE\_REPLACE\_INVALID\_UTF, is not yet mentioned in the draft [Compile-time Options](https://www.sqlite.org/draft/compile.html).

I would also submit that, for options which enable old but generally undesirable behavior, a better default is that the improvements take effect. For those few applications that rely on what should have been undefined behavior or behavior inconsistent with reasonable expectation, their developers can add the #define necessary to retain the status quo.

So, for the above option, 

```
#ifndef SQLITE_RETAIN_INVALID_UTF
/* Handle as previous versions did. */
#else
/* Translate invalid UTF to a standard code point. */
#endif
```

If this seems too onerous for those few developers, maybe a convention can be established that would appear in the sqlite3.h header, resembling the following:

```
#ifdef RETAIN_LEGACY_BEHAVIORS
#define RETAIN_GOOFINESS_X
#define RETAIN_STRANGENESS_Y
#define EXCLUDE_IMPROVEMENT_Z
#endif
```

The alternative (and present status quo) is that an ever-growing list of defines is necessary to enable improvements.  I submit that those who have no use for them can generally use the older code if they cannot bother to spell out which features of the older code they want compiled from newer code.