Your problem is that backslashes in literals are treated as escape sequences, so
'\gpkg_content.dbf' being treated as escape sequence
\g (which I think is invalid, hence the
?) followed by
You can use
\\ instead of
\ to represent an actual backslash. Or you could try
/: QGIS on Windows is pretty good at accepting UNIX-style forward-slash rather than backwards-slash filenames, though there are some gaps and it may depend on what you do with the output of the expression later.
Note this all applies to literals specified in
\ is not treated as an escape character if it comes from a field, for instance.