Sha256: 62ce408a8d3214247cb3cea38b552caf26cdf0c33c25be8711c1c5f5e782ee06

Contents?: true

Size: 308 Bytes

Versions: 19

Compression:

Stored size: 308 Bytes

Contents

use magnus::{prelude::*, Value};

#[test]
fn it_converts_to_utf8_string() {
    let ruby = unsafe { magnus::embed::init() };

    let val: Value = ruby
        .eval(r#""caf\xE9".force_encoding("ISO-8859-1")"#)
        .unwrap();
    let s = String::try_convert(val).unwrap();

    assert_eq!("café", s);
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/string.rs
wasmtime-28.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/string.rs
wasmtime-27.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/string.rs
wasmtime-26.0.0 ./ext/cargo-vendor/magnus-0.7.1/tests/string.rs
wasmtime-25.0.2 ./ext/cargo-vendor/magnus-0.6.4/tests/string.rs
wasmtime-25.0.1 ./ext/cargo-vendor/magnus-0.6.4/tests/string.rs
wasmtime-25.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/string.rs
wasmtime-24.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/string.rs
wasmtime-23.0.2 ./ext/cargo-vendor/magnus-0.6.4/tests/string.rs
wasmtime-22.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/string.rs
wasmtime-21.0.1 ./ext/cargo-vendor/magnus-0.6.4/tests/string.rs
wasmtime-20.0.2 ./ext/cargo-vendor/magnus-0.6.4/tests/string.rs
wasmtime-20.0.0 ./ext/cargo-vendor/magnus-0.6.4/tests/string.rs
wasmtime-18.0.3 ./ext/cargo-vendor/magnus-0.6.2/tests/string.rs
wasmtime-17.0.1 ./ext/cargo-vendor/magnus-0.6.2/tests/string.rs
wasmtime-17.0.0 ./ext/cargo-vendor/magnus-0.6.2/tests/string.rs
wasmtime-16.0.0 ./ext/cargo-vendor/magnus-0.6.2/tests/string.rs
wasmtime-15.0.1 ./ext/cargo-vendor/magnus-0.6.2/tests/string.rs
wasmtime-15.0.0 ./ext/cargo-vendor/magnus-0.6.2/tests/string.rs