[src]

Function std::str::from_utf16_lossy

pub fn from_utf16_lossy(v: &[u16]) -> ~str

Decode a UTF-16 encoded vector v into a string, replacing invalid data with the replacement character (U+FFFD).

Example

use std::str;

// š¯„˛mus<invalid>ic<invalid>
let v = [0xD834, 0xDD1E, 0x006d, 0x0075,
         0x0073, 0xDD1E, 0x0069, 0x0063,
         0xD834];

assert_eq!(str::from_utf16_lossy(v),
           ~"š¯„˛mus\uFFFDic\uFFFD");