php-general Digest 21 Nov 2012 10:30:23 -0000 Issue 8049
Topics (messages 319745 through 319750):
Re: globbed includes?
319745 by: Shawn McKenzie
Encode e-mail text in UTF-8
319746 by: MC
319748 by: Inigo Medina
319750 by: MC
Re: Date comparison going wrong, wrong, wrong
319747 by: Jim Lucas
319749 by: Terry Ally (Gmail)
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On 11/18/2012 02:29 PM, tamouse mailing lists wrote:
> There are certain times I'd like to include all files in a given
> directory (such as configuration stuff that is split out by type, a la
> apache conf.d). Anyone have something handy that implements that?
>
Just for fun:
array_walk(glob('*.php'), function($arg) { include($arg); });
--- End Message ---
--- Begin Message ---
Hi,
what is the recommended way to encode e-mail text in UTF-8?
When the site were running in a single byte code page like iso-8859-2 I
were happy with the imap_8bit function and quoted-printable encoding of
e-mails. However, the function does not seem to work correctly for
multi-byte code pages like UTF-8.
I have tried to search for alternatives but failed to find anything useful.
Thanks in advance for any tips.
MC
--- End Message ---
--- Begin Message ---
On Tue, 20 Nov 2012, MC wrote:
Hi,
what is the recommended way to encode e-mail text in UTF-8?
When the site were running in a single byte code page like iso-8859-2 I were
happy with the imap_8bit function and quoted-printable encoding of e-mails.
However, the function does not seem to work correctly for multi-byte code
pages like UTF-8.
Did you use header 'Content-Type:text/html;charset=utf-8' on the email?
iñ
I have tried to search for alternatives but failed to find anything useful.
Thanks in advance for any tips.
MC
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
what is the recommended way to encode e-mail text in UTF-8?
When the site were running in a single byte code page like iso-8859-2
I were happy with the imap_8bit function and quoted-printable encoding
of e-mails. However, the function does not seem to work correctly for
multi-byte code pages like UTF-8.
Did you use header 'Content-Type:text/html;charset=utf-8' on the email?
No, I am using text/plain content-type, more specifically:
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: QUOTED-PRINTABLE
The result e-mail looks like the following (I've replaced all english
letters with just x):
xxxxý xxxx
x xříxxxx xxxxxxxxx xxxxxx xxěxx x xxxx=xxx xx xxxxxí xxxxxxxxxx
xxxxxxxx x xxxxxxxxxx xxxxxxxxx
x xxxxx=xxx
xxxxxáxx xxxáxxx
The raw encoded version of the above text is the following:
xxxx=C3=BD xxxx=0A=
=0A=
x x=C5=99=C3=ADxxxx xxxxxxxxx xxxxxx xx=C4=9Bxx x xxxx=3Dxxx xx xxxxx=C3=AD=
xxxxxxxxxx xxxxxxxx x xxxxxxxxxx xxxxxxxxx=0A=
=0A=
x xxxxx=3Dxxx=0A=
=0A=
xxxxx=C3=A1xx xxx=C3=A1xxx=
The first "=" ("=3D") should be "f" and the second "a".
Or you think it might be a bug in the imap_8bit or imap_mail_compose
function? Parts/attachements which are rendered as BASE64 are not being
malformed, just the quoted printable ones.
Thanks,
MC
--- End Message ---
--- Begin Message ---
On 11/12/2012 02:06 AM, Duken Marga wrote:
Try this:
$todaydate = strtotime(date("D, M jS, Y g:i:s a"));
$showenddate = strtotime(date("D, M jS, Y g:i:s a",
strtotime($showsRecord['end_date'])));
Won't this give you the same results without the extra conversion steps?
$todaydate = date("U");
$showenddate = strtotime($showsRecord['end_date']);
if ($todaydate< $showenddate):
echo "The date of the show has not yet arrived";
else:
echo "The show has ended";
endif;
You must convert both $todaydate and $showendate with strtotime() function,
then you can compare them.
On Mon, Nov 12, 2012 at 1:30 AM, Terry Ally (Gmail)<terrya...@gmail.com>wrote:
Hi all,
I am having a problem with comparing time. I am using the following:
$todaydate = date("D, M jS, Y g:i:s a");
$showenddate = date("D, M jS, Y g:i:s a",
strtotime($showsRecord['end_date']));
if ($todaydate> $showenddate):
echo "The date of the show has not yet arrived";
else:
echo "The show has ended";
endif;
The problem that I am encountering is that PHP is rendering the reverse of
the equation. For example:
If today's date is *11 Nov 2012* and the show's end date is *18 Nov 2012*,
the message that I am getting is *the show has ended* which is wrong. A
test example is at http://www.lakesidesurrey.co.uk/test.php.
You can also me what I am doing wrong?
Thanks
Terry
--
Jim Lucas
http://www.cmsws.com/
http://www.cmsws.com/examples/
--- End Message ---
--- Begin Message ---
It's a nice shortcut Jim. Never considered that.
Thanks.
On 20 November 2012 21:03, Jim Lucas <li...@cmsws.com> wrote:
> On 11/12/2012 02:06 AM, Duken Marga wrote:
>
>> Try this:
>>
>> $todaydate = strtotime(date("D, M jS, Y g:i:s a"));
>> $showenddate = strtotime(date("D, M jS, Y g:i:s a",
>> strtotime($showsRecord['end_**date'])));
>>
>
> Won't this give you the same results without the extra conversion steps?
>
> $todaydate = date("U");
>
> $showenddate = strtotime($showsRecord['end_**date']);
>
>
>> if ($todaydate< $showenddate):
>> echo "The date of the show has not yet arrived";
>> else:
>> echo "The show has ended";
>> endif;
>>
>> You must convert both $todaydate and $showendate with strtotime()
>> function,
>> then you can compare them.
>>
>> On Mon, Nov 12, 2012 at 1:30 AM, Terry Ally (Gmail)<terrya...@gmail.com>*
>> *wrote:
>>
>> Hi all,
>>>
>>> I am having a problem with comparing time. I am using the following:
>>>
>>> $todaydate = date("D, M jS, Y g:i:s a");
>>> $showenddate = date("D, M jS, Y g:i:s a",
>>> strtotime($showsRecord['end_**date']));
>>>
>>> if ($todaydate> $showenddate):
>>> echo "The date of the show has not yet arrived";
>>> else:
>>> echo "The show has ended";
>>> endif;
>>>
>>> The problem that I am encountering is that PHP is rendering the reverse
>>> of
>>> the equation. For example:
>>>
>>> If today's date is *11 Nov 2012* and the show's end date is *18 Nov
>>> 2012*,
>>> the message that I am getting is *the show has ended* which is wrong. A
>>> test example is at
>>> http://www.lakesidesurrey.co.**uk/test.php<http://www.lakesidesurrey.co.uk/test.php>
>>> .
>>>
>>> You can also me what I am doing wrong?
>>>
>>> Thanks
>>> Terry
>>>
>>>
>>
>>
>>
>
> --
> Jim Lucas
>
> http://www.cmsws.com/
> http://www.cmsws.com/examples/
>
--
*Terry Ally*
Twitter.com/terryally
Facebook.com/terryally
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
To print or not to print this email is the environmentally-searching
question!
Which has the highest ecological cost? A sheet of paper or constantly
switching on your computer and connecting to the Internet to read your
email?
--- End Message ---