Reputation: 594
I have a ASP.NET web API running and have a client running into following issue:
{"model":["Unable to translate bytes [E9]
at index 300 from specified code page to Unicode."]}
The exception appears to be happening during model binding, which is the default nothing custom on my end.
The client is also running .NET and they say that the content is being sent over as UTF16
....but they are not including HTTP header to indicate that. Up until they began having special characters in their content everything worked great.
My question is how to deal with this. Initially I was going to add a DelegateHandler
which would detect this client and somehow set content-type/charset to UTF16
but that isn't panning out. I then thought I could transcode the request body to UTF8
from within DelegateHandler but have read that modifying content in handler is not possible or recommended.
Since the issue appears to be during model binding I'm wondering if implementing a custom model binder would be in order?
Thanks for any help!
Upvotes: 1
Views: 4940