我尝试使用 utl_smtp 和 Oracle 发送包含挪威字符 (å æ ø) 的电子邮件。否则,这些字符会在数据库中正确存储和显示,但在电子邮件中显示为问号。
我的数据库字符集是WE8MSWIN1252
我在电子邮件中尝试了不同的 Content-Type mime header ,包括“text/plain;” charset="win-1252"',这似乎没有帮助。
最佳答案
默认情况下,smtp 是 7 位 ascii(有点旧技术:)。您必须使用 UTL_SMTP.write_data
并来自 documentation :
Text (VARCHAR2) data sent using
WRITE_DATA
is converted to US7ASCII before it is sent. If the text contains multibyte characters, each multibyte character in the text that cannot be converted to US7ASCII is replaced by a '?' character. If 8BITMIME extension is negotiated with the SMTP server using the EHLO subprogram, multibyte VARCHAR2 data can be sent by first converting the text to RAW using theUTL_RAW
package, and then sending the RAW data usingWRITE_RAW_DATA
.
有一个sample demo package on OTN显示如何发送多字节电子邮件。
关于oracle - Oracle pl/sql 电子邮件中的特殊字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1530505/