Note that there are some explanatory texts on larger screens.

plurals
  1. POUnicode chars and Spring JavaMailSenderImpl, no unicode chars under Linux!
    text
    copied!<p>I'm using Spring and JavaMailSenderImpl, a famous spring class to send emails. My emails contain a lot of unicode chars like èéàò or most notably the dreaded € symbol. My classes work fine when the run on windows. The emails sent are with all the chars (plain text, no html). If I install my app on a Linux virtual server, I'll get all ? instead of the special chars. Is it Spring, Java configuration or something else?</p> <p><strong>Update</strong></p> <p>Basically the architecture is this: there is a Spring Web Application and I use spring JavaMailSenderImpl to get the work done. This is the configuration in servlet-context:</p> <pre><code>&lt;bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&gt; &lt;property name="host" value="${email.server}" /&gt; &lt;property name="username" value="${email.server_user}"&gt;&lt;/property&gt; &lt;property name="password" value="${email.server_pass}"&gt;&lt;/property&gt; &lt;/bean&gt; </code></pre> <p>I'm using the same host on windows and linux to send mail (that is not the same machine where the application runs on... It is just a standard mail service provider over SMTP).</p> <p>The code I use to send the email is simply:</p> <pre><code>SimpleMailMessage msg = new SimpleMailMessage(); msg.setTo(adminEmail); msg.setFrom(adminEmail); msg.setSubject(subject); msg.setText(message); mailSender.send(msg); </code></pre> <p>Even setting:</p> <pre><code>System.setProperty("mail.mime.charset", "utf8"); </code></pre> <p>at application startup doesn't solve the situation. In fact, before I was getting ? instead of €, now I get �...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload