-
Notifications
You must be signed in to change notification settings - Fork 94
StringError("text was not valid unicode") #106
Comments
What are you using to submit the request? Can you capture the raw request body? It's trying to interpret some binary field in the request as text but the image file seems to be uploaded successfully, based on the output you gave (its filename and media-type are printed). |
Yes that's why I'm confused why it's not printing the data on screen... also i'm still confused why it's printing with that error. Also i'm using a HTML form to submit the request, that looks something like this. <form action="/req/send" enctype="multipart/form-data" method="post">
<input type="file" name="myfile" id="file">
<input type="submit" value="Submit">
</form> |
Looking at the code, the error is occurring when trying to write the file contents to the response, but I haven't found which component is actually trying to parse the file contents as a string. |
@GitStonic nevermind capturing the request body, I just need to find where it's trying to parse the file as a string. It's somewhere in the call tree of |
What version of Iron are you using, anyway? |
I believe i'm using the latest version of Iron |
@GitStonic just to test an assumption, does the error still occur if you set the content type of the response to something like |
yes the error still occurs after setting the content-type to |
@GitStonic I started to get frustrated because I could not find that error string anywhere within I see a few possible solutions:
|
I see... I will try those options, Thank you for your time and effort for me. Really appreciate it. |
I need to fix these examples as well so I'm looking for opinions on the best approach. I wanted it to print the fields to stdout somehow but I dunno if I want to pull in another crate just for hashing/base64 conversion. |
I've submitted a PR to rust-lang/rust to make the error message more specific and to document the portability hazard. I still have to fixup the examples, I'll get to that sometime. |
…dtolnay Improve error message and docs for non-UTF-8 bytes in stdio on Windows This should make debugging problems like abonander/multipart#106 significantly more straightforward in the future. cc rust-lang#23344, @retep998 @alexcrichton Not sure who do r? so I'll let rust-highfive pick one.
So I was trying to use the multipart Iron example from the source... But the thing is when I upload a file specifically an image file it responds back with an error and doesn't respond back with the data fields... the error is stating this
I don't fully understand what this error means and why i'm getting it... but I feel like i'm doing something wrong but i'm not sure what though.
The text was updated successfully, but these errors were encountered: