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

时间:2015-03-03 03:48:49

标签: php wordpress encoding utf-8 woocommerce

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

如果电子邮件中出现希伯来字母/单词,则会显示为问号。在他们使用的变化出现之前,希伯来语没有任何问题。 管理员通过电子邮件了解新订单,库存,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

当网站设置为希伯来语时,所有电子邮件都是?????? ??? ????(号码除外);我将其设置为英语,以确保它不仅仅是翻译问题。

有什么想法吗?

2 个答案:

答案 0 :(得分:0)

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 );
}

答案 1 :(得分:0)

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. 至少使文字可见。