简体   繁体   English

使用Java Mail API发送电子邮件时出现编码问题

[英]Encoding problem while sending email using java mail API

I am sending email using java mail api in my application. 我在我的应用程序中使用Java Mail API发送电子邮件。 The subject of email contains hyphen( - ) character. 电子邮件的主题包含连字符(-)字符。 This works fine on windows machine. 这在Windows计算机上正常工作。 But once I deploy the application on linux machine, the recipients of email get emails with hyphen getting converted into question mark in the subject of emails. 但是,一旦我在Linux机器上部署了该应用程序,电子邮件的接收者就会收到带有连字符的电子邮件,并在电子邮件主题中将其转换为问号。

This problem is occurring in Cent OS linux environment. 在Cent OS linux环境中会发生此问题。 This is working fine with windows and ubuntu linux environment. 这在Windows和ubuntu linux环境下工作正常。

Can somebody please suggest what could be the problem? 有人可以建议出什么问题吗?

Thanks. 谢谢。

Are you sure the hyphen character is actually the regular ASCII hyphen (0x2D)? 您确定连字符实际上是常规的ASCII连字符(0x2D)吗? If it's something that looks like a hyphen, but is actually a Unicode character from a different language set, you could easily see encoding problems across environments. 如果它看起来像连字符,但实际上是来自不同语言集的Unicode字符,则您很容易看到跨环境的编码问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM