fn read_string(data: &[u8], seek: &mut usize, size: usize, length: Option<usize>) -> String {
    //println!("read_string(), size={} \t length={:?}", size, length);
    let length = length.unwrap_or(size);
    //let count = if size > 0 {size} else {length};
    let (cow, _encoding_used, had_errors) = WINDOWS_1252.decode(&data[*seek..*seek+length]);
    if had_errors {
        let parse = std::str::from_utf8(&data[*seek..*seek+length]);
        if parse.is_err() {panic!("Unable to read string");}
        *seek += size;
        return parse.unwrap().to_string();
    }
    *seek += size;
    (&cow).to_string()
}
/// Read a string
/// * `size`:   real string length
/// * `length`: optionnal provided length (in case of blank chars after the string)
Read a string
`size`:   real string length
`length`: optionnal provided length (in case of blank chars after the string)
Read a string ` size ` : real string length ` length ` : optionnal provided length ( in case of blank chars after the string )
fn read_string(data: &[u8], seek: &mut usize, size: usize, length: Option<usize>) -> String {
    //println!("read_string(), size={} \t length={:?}", size, length);
    let length = length.unwrap_or(size);
    //let count = if size > 0 {size} else {length};
    let (cow, _encoding_used, had_errors) = WINDOWS_1252.decode(&data[*seek..*seek+length]);
    if had_errors {
        let parse = std::str::from_utf8(&data[*seek..*seek+length]);
        if parse.is_err() {panic!("Unable to read string");}
        *seek += size;
        return parse.unwrap().to_string();
    }
    *seek += size;
    (&cow).to_string()
}
fn read_string ( data : & [ u8 ] , seek : & mut usize , size : usize , length : Option < usize > ) -> String { //println!("read_string(), size={} \t length={:?}", size, length); let length = length . unwrap_or ( size ) ; //let count = if size > 0 {size} else {length}; let ( cow , _encoding_used , had_errors ) = WINDOWS_1252 . decode ( & data [ * seek .. * seek + length ] ) ; if had_errors { let parse = std :: str :: from_utf8 ( & data [ * seek .. * seek + length ] ) ; if parse . is_err ( ) { panic ! ( " " ) ; } * seek += size ; return parse . unwrap ( ) . to_string ( ) ; } * seek += size ; ( & cow ) . to_string ( ) }
Read a string
 `size`:   real string length
 `length`: optionnal provided length (in case of blank chars after the string)
Read a string ` size ` : real string length ` length ` : optionnal provided length ( in case of blank chars after the string )
data
&[u8]
seek
&mut usize
size
usize
length
Option<usize>
data
&[u8]
seek
&mut usize
size
usize
length
Option<usize>