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

example/client: Cast to UTF-8 only the result page #16

Closed
kpp opened this issue Nov 23, 2018 · 0 comments
Closed

example/client: Cast to UTF-8 only the result page #16

kpp opened this issue Nov 23, 2018 · 0 comments

Comments

@kpp
Copy link

kpp commented Nov 23, 2018

let res = String::from_utf8_lossy(&buf[..len]);

You can collect the data into Vec<u8>, and after the loop ends you cast the data into String. Because the chunks may contain invalid UTF-8 if you try to cast each chunk to UTF8.

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

1 participant