<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Yet another problem with utf-8]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=6856</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6856&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Yet another problem with utf-8.]]></description>
		<lastBuildDate>Thu, 10 Aug 2017 14:56:48 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28363#p28363</link>
			<description><![CDATA[<p>@apmuthu &amp; @joe - Hi, is anything happening on this issue?</p>]]></description>
			<author><![CDATA[null@example.com (poncho1234)]]></author>
			<pubDate>Thu, 10 Aug 2017 14:56:48 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28363#p28363</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28183#p28183</link>
			<description><![CDATA[<p>@campbell, tried most of day to get content type working, but thanks for suggestion.</p>]]></description>
			<author><![CDATA[null@example.com (poncho1234)]]></author>
			<pubDate>Wed, 12 Jul 2017 22:34:40 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28183#p28183</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28180#p28180</link>
			<description><![CDATA[<p>Sorry, I mean the additional_headers parameter, not the body.&nbsp; From the php manual:</p><p>&quot;Note: When sending mail, the mail must contain a From header. This can be set with the additional_headers parameter, or a default can be set in php.ini. Failing to do this will result in an error message similar to Warning: mail(): &quot;sendmail_from&quot; not set in php.ini or custom &quot;From:&quot; header missing. The From header sets also Return-Path under Windows.&quot;</p><p>The content type header should be honored if the mail server supports it.</p>]]></description>
			<author><![CDATA[null@example.com (cambell)]]></author>
			<pubDate>Wed, 12 Jul 2017 14:51:30 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28180#p28180</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28178#p28178</link>
			<description><![CDATA[<p>function email($name, $mail)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;boundary = md5(uniqid(time()));</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if (extension_loaded(&#039;imap&#039;)) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;header = &quot;From: =?UTF-8?Q?&quot; .imap_8bit($name) .&quot;?=&quot;. &quot;&lt;$mail&gt;\n&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;header = &quot;From: =?UTF-8?B?&quot; .base64_encode($name) .&quot;?=&quot;. &quot;&lt;$mail&gt;\n&quot;;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; $bcc = get_company_pref(&#039;bcc_email&#039;);<br />&nbsp; &nbsp; &nbsp; &nbsp; if ($bcc)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;bcc[] = $bcc;<br />&nbsp; &nbsp; }</p><p>and</p><p>function subject($subject)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; if (extension_loaded(&#039;imap&#039;)) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;subject = &quot;=?UTF-8?Q?&quot; .imap_8bit($subject) .&quot;?=&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;subject = &quot;=?UTF-8?B?&quot; . base64_encode($subject) .&quot;?=&quot;;</p><p>&nbsp; &nbsp; }</p><p>Functions and tested</p><p>@campbell, Hi, the problem is not with the body, its with the header and the subject.</p>]]></description>
			<author><![CDATA[null@example.com (poncho1234)]]></author>
			<pubDate>Tue, 11 Jul 2017 13:15:48 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28178#p28178</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28175#p28175</link>
			<description><![CDATA[<p>Looking at this <a href="https://stackoverflow.com/questions/19997052/adding-unicode-utf8-to-email">Stack Overflow answer</a> I would suggest adding the &#039;Content-Type: text/plain; charset=UTF-8&#039; header to the &#039;body&#039; parameter in the call to the mail function.</p><p>It seems from <a href="https://medium.com/@zackbloom/i-have-a-unicode-email-address-fbecd630ec12">this post</a> that support for unicode email addresses in the local part is relatively new. e.g. Postfix supported it in 2014.&nbsp; It very much depends on what email software your server (or ISP) has installed to support the sending of email.&nbsp; I suspect that if you use gmail, or google apps for business then you wouldn&#039;t have any problems (assuming the content header is set correctly).&nbsp; Using Postfix for example you would need to ensure that version 3.0 or greater is installed.&nbsp; In the debian world this would be Debian Stretch.&nbsp; Wheezy and Jessie are both on Postfix 2.x.&nbsp; You can find further information on SMTPUTF8 support and links to relevant RFC on the Postfix <a href="http://www.postfix.org/SMTPUTF8_README.html">SMTPUFT8</a> page.</p><p>To be safe, I would suggest that all email addresses in *your* organization use the 128 lowercase ascii characters as required under the old standard.</p>]]></description>
			<author><![CDATA[null@example.com (cambell)]]></author>
			<pubDate>Tue, 11 Jul 2017 01:57:21 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28175#p28175</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28174#p28174</link>
			<description><![CDATA[<p>@apmuthu it says its experimental? Are there FA users with unusable email addresses? If yes can you point me to the relevant post or give an example.</p><p>I will try to do an if / else tomorrow. Trying to think how I will test it... any ideas?</p>]]></description>
			<author><![CDATA[null@example.com (poncho1234)]]></author>
			<pubDate>Tue, 11 Jul 2017 01:22:37 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28174#p28174</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28173#p28173</link>
			<description><![CDATA[<p><a href="http://www.ietf.org/rfc/rfc5336.txt">RFC 5336</a> - SMTP Extension for Internationalized Email Addresses.</p><p>IMAP<br />====<br /></p><div class="codebox"><pre><code>if (extension_loaded(&#039;imap&#039;)) {

....
....

}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 11 Jul 2017 00:26:22 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28173#p28173</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28171#p28171</link>
			<description><![CDATA[<p>The other item that needs to be sorted out is the subject; the following works for me; replace class.mail.inc line 77 from:-</p><p>function subject($subject)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;subject = $subject;<br />&nbsp; &nbsp; }</p><p>to:-</p><p>function subject($subject)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;subject = &quot;=?UTF-8?B?&quot; . base64_encode($subject) .&quot;?=&quot;;<br />&nbsp; &nbsp; }</p><p>or</p><p>function subject($subject)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;subject = &quot;=?UTF-8?Q?&quot; .imap_8bit($subject) .&quot;?=&quot;;//you will need the imap module enabled<br />&nbsp; &nbsp; }</p><p>I believe this only leaves the email addresses, which &#039;generally&#039; are not allowed to include diacriticals. (though there is some debate about this - Google &#039;Are accents allowed in email addresses&#039; - for starters)</p><br /><p>Very interested in your comments.</p><br /><p>What is the history / background? ie Did company name and email subject function with accents before the change to utf-8?</p>]]></description>
			<author><![CDATA[null@example.com (poncho1234)]]></author>
			<pubDate>Mon, 10 Jul 2017 21:08:35 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28171#p28171</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28154#p28154</link>
			<description><![CDATA[<p>We will have to consult Janusz with this. I will.</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Sat, 08 Jul 2017 21:51:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28154#p28154</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28149#p28149</link>
			<description><![CDATA[<p>@joe?</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 08 Jul 2017 16:16:10 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28149#p28149</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28147#p28147</link>
			<description><![CDATA[<p>Working solution:-</p><p>Replace class.mail.inc line 49 from:-</p><p>$this-&gt;header = &quot;From: $name &lt;$mail&gt;\n&quot;;</p><p>with either:-</p><p>$this-&gt;header = &quot;From: =?UTF-8?B?&quot; .base64_encode($name) .&quot;?=&quot;. &quot;&lt;$mail&gt;\n&quot;;</p><p>OR</p><p>$this-&gt;header = &quot;From: =?UTF-8?Q?&quot; .imap_8bit($name) .&quot;?=&quot;. &quot;&lt;$mail&gt;\n&quot;; //you will need the imap module enabled</p><p>depending if you want base64 or imap </p><p>You should now be able to use any diacritical in your company name.</p><p>@apmuthu I&#039;m struggling with the&nbsp; mb_send_mail() &amp; mb_encode_mimeheader(), from my understanding this encodes the whole header: When I got it to work it actually used my servers email address as the from, whereas in the above solution the actual servers email address is hidden and the company email address is shown as per FA functionality.&nbsp; Can you help?</p>]]></description>
			<author><![CDATA[null@example.com (poncho1234)]]></author>
			<pubDate>Sat, 08 Jul 2017 14:26:20 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28147#p28147</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28140#p28140</link>
			<description><![CDATA[<p>From the same link:<br /></p><div class="quotebox"><blockquote><p>You might want to use <a href="http://php.net/manual/en/function.mb-send-mail.php">mb_send_mail()</a>. It uses <a href="http://php.net/manual/en/function.mail.php">mail()</a> internally, but encodes subject and body of the message automatically. Again, <a href="http://php.net/manual/en/function.mb-send-mail.php#95753">use with care</a>.</p></blockquote></div><p>The <strong>mb_encode_mimeheader()</strong> method is also listed.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 08 Jul 2017 04:16:39 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28140#p28140</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28138#p28138</link>
			<description><![CDATA[<p>Ok, I have a partial solution which looks promising:-</p><p>From my understanding $name is not encoded so accented char will never work, <a href="https://stackoverflow.com/questions/4389676/email-from-php-has-broken-subject-header-encoding">this post at stackexchange</a> pointed me in the right direction, so changing <strong>class.mail.inc</strong> line 49 from:-</p><p>$this-&gt;header = &quot;From: $name &lt;$mail&gt;\n&quot;;</p><p>to</p><p>$this-&gt;header = &quot;From: =?UTF-8?B?&quot; .base64_encode($name).&quot;?=&quot;;</p><p>does work, BUT:-</p><p>does NOT include the newline \n so the from $name is followed by the Bcc: bccemailaddress@example.com</p><p>So I tried to introduce a new line with the following code:-</p><p>$this-&gt;header = &quot;From: =?UTF-8?B?&quot; .base64_encode($name).&quot;?=&quot;, &quot;\n&quot;;<br />and<br />$this-&gt;header = &quot;From: =?UTF-8?B?&quot; .base64_encode($name).&quot;?=&quot;. &quot;\n&quot;;</p><p>but neither of these work as the from is now the base64 code</p><p>If anyone knows a little more php than me can help add a new line please do, will sleep on it.</p>]]></description>
			<author><![CDATA[null@example.com (poncho1234)]]></author>
			<pubDate>Sat, 08 Jul 2017 01:57:52 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28138#p28138</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28137#p28137</link>
			<description><![CDATA[<p>To eliminate the database encoding issue (if this is the problem) I hard coded the company name in class.mail.inc line 49 from:-</p><p>$this-&gt;header = &quot;From: $name &lt;$mail&gt;\n&quot;;</p><p>to</p><p>$this-&gt;header = &quot;From: &#039;Psicopedagógico&#039; &lt;$mail&gt;\n&quot;;</p><p>I first tried with a normal &#039;o&#039; and all emails were sent perfectly.</p><p>When I replaced the normal &#039;o&#039; with an accented &#039;ó&#039;, emails failed to send with the same fault code:- <br />&nbsp; &nbsp; SMTP error from remote mail server after end of data:<br />&nbsp; &nbsp; 550 From contains invalid characters.</p><br /><p>For me this says that the problem is in the encoding of the email header not with the database.</p><p>I re-tried:-</p><p>var $charset = &#039;iso-8859-1&#039;;<br />to<br />var $charset = &#039;utf-8&#039;; //also tried utf8<br />and<br />var $charset = &#039;utf8_unicode_ci&#039;;<br />and<br />var $charset = &#039;utf8mb4_unicode_ci&#039;;</p><p>All failed. I&#039;ve since read that all SMPT headers should be ASCII encoded. (I did try ASCII &amp; even 8BITMIME but maybe unsurprisingly they failed too as believe they don&#039;t include an accent &#039;ó&#039;) </p><p>I&#039;m now looking for where the encoding from charset happens, And I&#039;can&#039;t seem to find it?</p>]]></description>
			<author><![CDATA[null@example.com (poncho1234)]]></author>
			<pubDate>Fri, 07 Jul 2017 23:31:49 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28137#p28137</guid>
		</item>
		<item>
			<title><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28135#p28135</link>
			<description><![CDATA[<p>I have tried setting class.mail.inc line 41<br />from<br />var $charset = &#039;iso-8859-1&#039;;<br />to<br />var $charset = &#039;utf-8&#039;; //also tried utf8<br />and<br />var $charset = &#039;utf8_unicode_ci&#039;;<br />and<br />var $charset = &#039;utf8mb4_unicode_ci&#039;;</p><br /><p>Not sure what you mean about url encoding?</p><p>The problem is in company name in company configuration, not in the email address: I have tried quoted format, this returns &#039;&amp;quot&#039; in the email company name, I&#039;ve also tried psicopedag&amp;oacute;gico</p><p>I assume:-<br />HTML Entity (decimal) &nbsp; &nbsp; &amp;#243;<br />HTML Entity (hex) &nbsp; &nbsp; &amp;#xf3;<br />will have the same result as &amp;oacute; unless you can tell me otherwise?</p>]]></description>
			<author><![CDATA[null@example.com (poncho1234)]]></author>
			<pubDate>Fri, 07 Jul 2017 18:06:21 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28135#p28135</guid>
		</item>
	</channel>
</rss>
