Bug #18521: htmlentities with charset iso-8859-7 anomalies
| From: | spud at nothingness dot org | Date: | Wed, 24 Jul 2002 03:29:51 +0000 |
| Subject: | Bug #18521: htmlentities with charset iso-8859-7 anomalies | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-14975@lists.php.net to get a copy of this message | ||
From: spud@nothingness.org
Operating system: Linux (RedHat 7.2)
PHP version: 4.2.2
PHP Bug Type: Strings related
Bug description: htmlentities with charset iso-8859-7 anomalies
PHP compiled with:
./configure --with-config-file-path=/usr/local --with-mysql --with-gd
--with-gettext=/usr/bin --with-jpeg-dir --with-png-dir --with-tiff-dir
--with-ttf --with--enable-bcmath --enable-inline-optimization
--enable-sysvsem --enable-sysvshm --enable-trans-sid
--enable-shared-pdflib --with-regex=system --with-zlib
--with-curl=/usr/include --enable-sockets --with-apxs=/usr/sbin/apxs
I have been attempting to internationalize my PHP application
(specifically to support Greek). Data is stored in MySQL, and displayed on
the page using
nl2br(htmlentities($body))
For internationalization, I changed this to
nl2br(htmlentities($body,ENT_COMPAT,'ISO-8859-7'))
...but the Greek text appears on the page as accented Latin 1 characters,
rather than Greek. (This line is the only "short script" necessary to
reproduce the problem, as long as the $body variable contains Greek
text).
If I use htmlspecialchars() instead, still indicating the charset, the
text appears fine (in Greek). If I simply use
nl2br($body)
it also appears in Greek (but won't, obviously, escape any special
characters). So its appears to be directly related to htmlentities().
The web page itself contains a META header indicating
content="text/html; charset=ISO-8859-7"
...so the page should know what charset to expect, and shouldn't be part
of the problem.
This bug was also present in PHP 4.2.1.
--
Edit bug report at http://bugs.php.net/?id=18521&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18521&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18521&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18521&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18521&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18521&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18521&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18521&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18521&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18521&r=globals