【问题标题】:Woocommerce Client order email - Encoding issue in hebrewWoocommerce 客户订单电子邮件 - 希伯来语编码问题
【发布时间】:2015-03-03 03:48:48
【问题描述】:

我移动了一个站点服务器并升级到 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 你能分享你网站的网址吗?
  • 附言。我在服务器上的不同域上安装了另一个全新安装,同样的问题。我猜它与服务器有关。问题是究竟是什么。

标签: php wordpress encoding utf-8 woocommerce


【解决方案1】:

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

【讨论】:

  • 检查过,同样的问题。谢谢
【解决方案2】:

batz 很抱歉,我无法测试我的答案,所以我仍然不能保证它们会起作用。追查这个错误的确切原因会很棘手。

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

方法一

在您主题的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>
';
}

方法二

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

  1. 帮助我们找出问题的根源 - 如果将电子邮件更改为纯文本有帮助,请告诉我;
  2. 至少让文本可见。

【讨论】:

  • 嗨。谢谢您的帮助。方法2有效。方法 1 不起作用。但我需要 html 选项才能工作。如果你想现场测试,我在服务器上设置了一个域,安装了 word-press 和 woo,也有同样的问题。地址:shulchani dot com。要访问 admin 如果您想要用户: admin ,请通过: 123456 。你可以随心所欲地改变它,它是唯一的测试域。
猜你喜欢
  • 2012-05-17
  • 1970-01-01
  • 2017-08-08
  • 1970-01-01
  • 2014-05-31
  • 1970-01-01
  • 1970-01-01
  • 2018-03-21
  • 1970-01-01
相关资源
最近更新 更多