You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to Spring boot v2.4.3 and Spring v5.3.4. We noticed that when uploading files via Webflux, the filenames containing accentuated characters (i.e é,à...) end up as a jumbled mess in the destination.
I believe this is due to the fact that Spring now uses DefaultPartHttpMessageReader that uses ISO_8859_1 (default encoding for multipart/from-data) to read the Part instead of SynchronossPartHttpMessageReader that defaulted to UTF-8 in case no character encoding was specified .
I have added nio-multipart-parser as a dependency and configured my app as follows :
public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) { SynchronossPartHttpMessageReader partReader = new SynchronossPartHttpMessageReader(); MultipartHttpMessageReader multiPartReader = new MultipartHttpMessageReader(partReader); configurer.defaultCodecs().multipartReader(multiPartReader); configurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper)); configurer.defaultCodecs().maxInMemorySize(8 * 1024 * 1024); }
With this configuration the UTF-8 characters are correctly read once again. But we really want to benefit from the new Streaming Mode that comes with DefaultPartHttpMessageReader.
Can DefaultPartHttpMessageReader offer the possibility of overriding the default character encoding ?
I thank you in advance for your reply.
The text was updated successfully, but these errors were encountered:
Affects: 5.3.4
After upgrading to Spring boot v2.4.3 and Spring v5.3.4. We noticed that when uploading files via Webflux, the filenames containing accentuated characters (i.e é,à...) end up as a jumbled mess in the destination.
I believe this is due to the fact that Spring now uses DefaultPartHttpMessageReader that uses ISO_8859_1 (default encoding for multipart/from-data) to read the Part instead of SynchronossPartHttpMessageReader that defaulted to UTF-8 in case no character encoding was specified .
I have added nio-multipart-parser as a dependency and configured my app as follows :
public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) { SynchronossPartHttpMessageReader partReader = new SynchronossPartHttpMessageReader(); MultipartHttpMessageReader multiPartReader = new MultipartHttpMessageReader(partReader); configurer.defaultCodecs().multipartReader(multiPartReader); configurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper)); configurer.defaultCodecs().maxInMemorySize(8 * 1024 * 1024); }
With this configuration the UTF-8 characters are correctly read once again. But we really want to benefit from the new Streaming Mode that comes with DefaultPartHttpMessageReader.
Can DefaultPartHttpMessageReader offer the possibility of overriding the default character encoding ?
I thank you in advance for your reply.
The text was updated successfully, but these errors were encountered: