I am trying to upload a file of Spanish text and although I have set the default encoding on my multipartResolver to 'UTF-8' when I create a String by converting the MultipartFile to a byte array it isnt recognizing the Spanish characters.
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.C ommonsMultipartResolver">
<property name="defaultEncoding" value="UTF-8"/>
</bean>
In the command class:
Code:
public void setSpanishTextFile(MultipartFile spanishTextFile) throws UnsupportedEncodingException, IOException {
this.spanishTextFile = spanishTextFile;
String x = new String(spanishTextFile.getBytes(), "UTF-8");
System.out.println(x);
}
The Spanish text file:
Una cuenta del usuario se ha creado para que le tenga acceso
Después de que usted haya entrado para la primera vez usted debe cambiar su contraseña. Asegúrese por favor de que su contraseña esté mantenida confidencial siempre.
¡Gracias por colocarse con myCochlear.com! Si usted tiene cualesquiera investigaciones, entre en contacto con por favor el puesto de informaciones para hablar a un representante/delegado técnico de cliente.
Am I missing something here?