Re: [PHP4BETA] Re: imap_utf7_decode doesn't work
| From: | Andrew Skalski | Date: | Mon, 24 Apr 2000 22:03:58 +0000 |
| Subject: | Re: [PHP4BETA] Re: imap_utf7_decode doesn't work | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14026@lists.php.net to get a copy of this message | ||
Okay, after looking deeper into this, i found a glitch in hholzgra's
march 14th patch. the effect is that $x != utf7_decode(utf7_encode($x))
(a bad thing) Furthermore, since php strings are composed of single
byte characters, the patch makes it impossible to encode non-ascii
unicode characters (japanese text, for instance.) Therefore, I am
rolling back that patch. The proper way to encode ASCII text will
be first to zero-extend each character to two characters:
"Test String" -> "\0T\0e\0s\0t\0 \0S\0t\0r\0i\0n\0g"
The result (Unicode) can then be passed to imap_utf7_encode().
If/when PHP supports wide-character strings, we can revisit this.
andy
On Mon, Apr 24, 2000 at 04:47:29PM -0400, Andrew Skalski wrote:
> I tested this with the latest CVS's of php4 and zend, and this is
> what happened... it misbehaved as an apache module, but it worked
> properly when compiled standalone (CGI).
>
> Between now and the time I commited the original utf7 functions, someone
> modified the decode function to output wide characters. The result,
> each letter of output is now two characters wide: a zero byte followed
> by an ASCII byte. The CGI sapi flush function simply does a "fwrite".
> I suspect that something inside apache is stopping the flush after it
> hits the first zero byte.
>
> Which leaves us with how to resolve the problem.. does apache get changed,
> does sapi get changed, or do we roll back those wide character changes
> in utf7_decode?
>
> andy
>
>
> On Sat, Apr 22, 2000 at 12:26:22AM -0500, chagenbu@wso.williams.edu wrote:
> > In php4 cvs, imap_utf7_decode doesn't return anything once it hits an encoded
> > character. For instance:
> >
> > imap_utf7_decode('&APYA9gD2-');
> >
> > ... will return an empty string.
> >
> > imap_utf7_decode('abc&APYA9gD2-foo');
> >
> > ... returns 'abc'.
> >
> > However, it all seems to work fine with php3. I can't figure out what's
> > different - it must be something in the Zend/PHP API, but I have no idea what.
> > Can someone take a look, or at least verify the behavior?
> >
> > -chuck
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>