Use libc for setlocale() to fix non-ASCII (#256)
* Use libc for setlocale() to fix non-ASCII character printing. https://github.com/hrkfdn/ncspot/issues/221 * move string instantiation outside unsafe block update libc crate while at it Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
@@ -46,6 +46,7 @@ use std::sync::Arc;
|
||||
use clap::{App, Arg};
|
||||
use cursive::traits::Identifiable;
|
||||
use cursive::{Cursive, CursiveExt};
|
||||
use std::ffi::CString;
|
||||
|
||||
use librespot_core::authentication::Credentials;
|
||||
use librespot_core::cache::Cache;
|
||||
@@ -142,6 +143,9 @@ struct UserDataInner {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let buf = CString::new("").unwrap();
|
||||
unsafe { libc::setlocale(libc::LC_ALL, buf.as_ptr()) };
|
||||
|
||||
let backends = {
|
||||
let backends: Vec<&str> = audio_backend::BACKENDS.iter().map(|b| b.0).collect();
|
||||
format!("Audio backends: {}", backends.join(", "))
|
||||
|
||||
Reference in New Issue
Block a user