<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Yet another problem with utf-8]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6856&amp;type=atom" />
	<updated>2017-08-10T14:56:48Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=6856</id>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28363#p28363" />
			<content type="html"><![CDATA[<p>@apmuthu &amp; @joe - Hi, is anything happening on this issue?</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-08-10T14:56:48Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28363#p28363</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28183#p28183" />
			<content type="html"><![CDATA[<p>@campbell, tried most of day to get content type working, but thanks for suggestion.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-07-12T22:34:40Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28183#p28183</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28180#p28180" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[cambell]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19447</uri>
			</author>
			<updated>2017-07-12T14:51:30Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28180#p28180</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28178#p28178" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-07-11T13:15:48Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28178#p28178</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28175#p28175" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[cambell]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19447</uri>
			</author>
			<updated>2017-07-11T01:57:21Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28175#p28175</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28174#p28174" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-07-11T01:22:37Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28174#p28174</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28173#p28173" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-07-11T00:26:22Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28173#p28173</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28171#p28171" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-07-10T21:08:35Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28171#p28171</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28154#p28154" />
			<content type="html"><![CDATA[<p>We will have to consult Janusz with this. I will.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2017-07-08T21:51:59Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28154#p28154</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28149#p28149" />
			<content type="html"><![CDATA[<p>@joe?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-07-08T16:16:10Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28149#p28149</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28147#p28147" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-07-08T14:26:20Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28147#p28147</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28140#p28140" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-07-08T04:16:39Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28140#p28140</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28138#p28138" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-07-08T01:57:52Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28138#p28138</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28137#p28137" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-07-07T23:31:49Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28137#p28137</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Yet another problem with utf-8]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28135#p28135" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2017-07-07T18:06:21Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28135#p28135</id>
		</entry>
</feed>
