Wooccommerce客户订单电子邮件-希伯来语编码问题


Woocommerce Client order email - Encoding issue in hebrew

我移动了一个站点服务器并升级到了woocommerce;从那以后,我在给客户的电子邮件方面遇到了问题(新订单,订单中添加了注释):

如果电子邮件中出现希伯来语字母/单词,它们将显示为问号。在他们使用的变化出现在希伯来语中没有任何问题。管理员收到的关于新订单、库存、ETC和所有网站的电子邮件,希伯来语似乎没有问题。

电子邮件如下:

您的订单已收到,目前正在处理中。您的订单详细信息如下所示,供您参考::??????:312700:783??????"????"????。

?????? ?????? ?? ????? ?? ??? + ???? ?????. ??? ????? ?? ???? ?????? ??? 2045 ?????? , ????? “???? 2045″.
?? ?? ??? ???? ????? ?? ?????? ????? ????? ???.
* ?????? ?? ???? ?? ??????? ?????.
* ????? ??????? ?? ????? ??? ??? ?????, ?????? ????? ????????
*?????? ??? ????? ??? 3 ??? ?????
 ???? ?????
 StoreName
 Our Bank Details
 ???? ???? - ??????
 Account Number: 879878
 Sort Code: ???? 989
 Order #2656
 Product  Quantity    Price
 ???? ???????? ????? ?? OFRA   1  ₪170.00
 Cart Subtotal:   ₪170.00
 Shipping:    ????? ????
 Payment Method:  ????? ??????
 Order Total:     ₪170.00
 Your details
 Email: email@gmail.com
 Tel: 90809
 Billing address
 ???????? ??????
 ?????
 ?????
 09809
 Shipping address
 ???????? ??????
 ?????
 ?????
 09809

当站点设置为希伯来语时,所有电子邮件都是?????? ??? ????(数字除外);我把它设置为英语,以确保这不仅仅是一个翻译问题。

有什么想法吗?

batz尝试打开/wp-content/plugins/woocommerce/includes/emails/class-wc-email.php,查找以下代码:

/**
 * get_headers function.
 *
 * @return string
 */
public function get_headers() {
    return apply_filters( 'woocommerce_email_headers', "Content-Type: " . $this->get_content_type() . "'r'n", $this->id, $this->object );
}

并将其更改为:

/**
 * get_headers function.
 *
 * @return string
 */
public function get_headers() {
    return apply_filters( 'woocommerce_email_headers', "Content-Type: " . $this->get_content_type() . "; charset=UTF-8'r'n", $this->id, $this->object );
}

batz很抱歉我不能测试我的答案,所以我仍然不能保证它们会起作用。追踪这个错误的确切原因将是一件棘手的事情。

到目前为止,我发现不幸的是,WooCommerce的电子邮件不支持从右到左的脚本,所以即使我们得到了正确的字形显示,您可能仍然会遇到一些问题。但值得一试。

方法1

在主题的functions.php文件中添加以下代码:

add_action('woocommerce_email_header', 'add_css_to_email');
function add_css_to_email() {
echo '
<style type="text/css">
* {
    font-family: sans-serif !important;
}
</style>
';
}

方法2

如果方法1不起作用,请尝试转到Dashboard > WooCommerce > Settings > Emails,然后逐个选择所有电子邮件,并将Email TypeHTML更改为Plain text。这可能不是一个理想的解决方案,但它可以:

  1. 帮助我们找到问题的根源-请让我知道将电子邮件更改为纯文本是否有帮助
  2. 至少使文本可见