Closed qmdx closed 4 years ago
It appears that diesel is putting invalid UTF-8 into a string. This issue should be filed with that project.
thanks , The problem is found. It's really a Postgres instance of diesel reading instead of utf8
To be clear: Diesel does not put any invalid UTF-8 string anywhere. I would guess that this is an issue with a not supported/broken setup.
The invalid string would be in the diesel error type, not in the connection manager.
The only potential point where this could happen is if the database returns a non utf8 string as error message. In this case the user has an unsupported setup from diesels point of view.
If you are providing a safe interface, you are obligated to ensure that your interface does not expose safe code to undefined behavior. Building a string from invalid UTF-8 data is undefined behavior.
To be sure: The underlying encoding is set to UTF8, so if I'm sure that's not the problem. Edit: Your are right, there is one way this is called before the encoding is set. That definitely should be fixed, because that's a bug. Nerveless: This will continue to be an unsupported configuration, so the fix will "just" improve the error message.
I've put a fix into https://github.com/diesel-rs/diesel/pull/2239
@weiznich @sfackler
This anomaly can be reproduced, When Postgres database Collation Order
And Character Classification
is not inutf8
format.
Possible problems:
r2d2-0.8.7/src/lib.rs:554
Error Log