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

File upload Problem with Encoding #334

Closed
ads69 opened this issue Feb 28, 2020 · 3 comments
Closed

File upload Problem with Encoding #334

ads69 opened this issue Feb 28, 2020 · 3 comments
Assignees
Labels
accepted Issue has been accepted and inserted in a future milestone
Milestone

Comments

@ads69
Copy link

ads69 commented Feb 28, 2020

Hi,
I have made something based on the file Upload sample and no problem when uploading binary files like pictures.
When I try to upload a specific pdf file I get this error :

No mapping for the Unicode character exists in the target multi-byte code page>

the code I use is the same
lFile := TFile.Create(lFName); lFile.CopyFrom(Context.Request.Files[0].Stream, 0);
Any idea ?

Best regards

@danieleteti
Copy link
Owner

Did you try to use the sample with that pdf file? I cannot reproduce the error.

@ads69
Copy link
Author

ads69 commented Mar 2, 2020

Hi Daniele,
You're right the in the sample it works but I use the swagger in my side.
using this parameter
[MVCSwagParam(plFormData, 'file', 'File to upload', ptFile, False)]
Best regards

@ads69
Copy link
Author

ads69 commented Mar 2, 2020

Daniele,
I have finally found where the problem is and reproduced it with the sample.
I use the MiddleWare Trace (MVCFramework,MVCFramework.Middleware.Trace).
If I do
MVC.AddMiddleware(TMVCTraceMiddleware.Create);

The problem occurs here :

 lContentStream.WriteString(EncodingGetString(Context.Request.Headers['content-type'],
      Context.Request.RawWebRequest.RawContent));

Best regards

Armindo

@danieleteti danieleteti self-assigned this Mar 5, 2020
@danieleteti danieleteti added the accepted Issue has been accepted and inserted in a future milestone label Mar 5, 2020
@danieleteti danieleteti added this to the 3.2.0-boron milestone Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Issue has been accepted and inserted in a future milestone
Projects
None yet
Development

No branches or pull requests

2 participants