Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"stream did not contain valid UTF-8"エラーが発生する. #2

Open
shunsuke44 opened this issue Jan 20, 2023 · 1 comment
Open

Comments

@shunsuke44
Copy link

発生箇所

.map(|e| e.unwrap());

  • PLYファイルフォーマット binary little endian
@Indigo2233
Copy link

I use this for binary .ply file:

    let ply_file = if fmt == "bin" {
        let mut lines = BufReader::new(File::open(path).unwrap());
        let mut lines_v = vec![];
        loop {
            let mut line = "".to_owned();
            lines.read_line(&mut line).unwrap();
            if line == "end_header\n" { break; }
            lines_v.push(line.trim_end().to_owned());
        }
        lines_v.push("end_header".to_owned());

        let mut buf = vec![];
        lines.read_to_end(&mut buf).unwrap();
        lines_v.push(unsafe { String::from_utf8_unchecked(buf) });
        PLYFile::from_lines(&mut lines_v.into_iter())
    } else {
        PLYFile::from_file(path).unwrap()
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants