utf8 conversion errors on old firebird 2.5 - 5 charset NONE databases #170
Unanswered
rpijnacker
asked this question in
Q&A
Replies: 1 comment
-
|
Have you tried make a converter with two connection instances?
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We are coming from delphi and are converting our software from unidac to rust using rfsbclient.
Works great after we convert database to charset WIN1252 for utf8 compabilty.
To convert from charset NONE to WIN1252 we need to do metadata extract and insert all data from old to new database
We have such hhuge database that we cannot achieve this in operation downtime is to big
Backup and restore can be done but complete pump of data takes too long
We have written our own flexible serde implementation to create json dynamically from sql/tables statements.
Our problem is that hen we setup driver with
rsfbclient::builder_native()
// .with_dyn_link()
.with_dyn_load(
firebird_driver.clone()
)
.with_remote()
.host(host)
.port(port)
.db_name(db_name)
.charset(Charset { on_firebird: ("NONE"), on_rust: None })
.to_owned()
and do our own conversion , in the rfsbclient already an utf8 conversion occurs cause it does not covers the case of real NONE connection. Can this be supported in the drivers or advise us how to write our own implementation so we can use firebird 2.5 to firebird 5 type 1 charset NONE connections. I think this applies for a lot of users that want to convert from delphi and never consider
anything about charsets
fn sql_type_to_val(v: SqlType) -> Option {
match v {
// ==================== TEXT (VARCHAR, CHAR, TEXT) ====================
SqlType::Text(text) => {
if text.contains("Array") {
// Your original array logic
if let Ok(json_val) = serde_json::from_str(&text[5..]) {
Some(json_val)
} else {
Some(Value::Null)
}
} else if text.contains("JSON") {
// Your original JSON logic
if let Ok(json_val) = serde_json::from_str(&text[4..]) {
Some(json_val)
} else {
Some(Value::Null)
}
} else {
// Normal text coming from Firebird with charset=NONE
let bytes = text.into_bytes();
}
Beta Was this translation helpful? Give feedback.
All reactions