Fix encoding for email & name, fix qrencode command in repl

This commit is contained in:
jikstra
2019-09-04 16:37:45 +02:00
committed by holger krekel
parent cc2339fbe2
commit 4ffe71e1df
2 changed files with 7 additions and 4 deletions

View File

@@ -525,7 +525,7 @@ unsafe fn handle_cmd(line: &str, ctx: Arc<RwLock<Context>>) -> Result<ExitResult
}
println!("{}", qr);
let output = Command::new("qrencode")
.args(&["-t", "ansiutf8", format!("\"{}\"", qr.as_str()).as_str(), "-o", "-"])
.args(&["-t", "ansiutf8", qr.as_str(), "-o", "-"])
.output()
.expect("failed to execute process");
io::stdout().write_all(&output.stdout).unwrap();

View File

@@ -1,5 +1,5 @@
use mmime::mailimf_types::*;
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
use percent_encoding::{utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC};
use std::ptr;
use crate::aheader::EncryptPreference;
@@ -22,6 +22,9 @@ use crate::stock::StockMessage;
use crate::types::*;
use crate::x::*;
pub const NON_ALPHANUMERIC_WITHOUT_DOT: &AsciiSet = &NON_ALPHANUMERIC
.remove(b'.');
pub unsafe fn dc_get_securejoin_qr(
context: &Context,
group_chat_id: uint32_t,
@@ -76,8 +79,8 @@ pub unsafe fn dc_get_securejoin_qr(
return cleanup(fingerprint, qr);
}
let self_addr_urlencoded = utf8_percent_encode(&self_addr, NON_ALPHANUMERIC).to_string();
let self_name_urlencoded = utf8_percent_encode(&self_name, NON_ALPHANUMERIC).to_string();
let self_addr_urlencoded = utf8_percent_encode(&self_addr, NON_ALPHANUMERIC_WITHOUT_DOT).to_string();
let self_name_urlencoded = utf8_percent_encode(&self_name, NON_ALPHANUMERIC_WITHOUT_DOT).to_string();
qr = if 0 != group_chat_id {
if let Ok(chat) = Chat::load_from_db(context, group_chat_id) {