From:             andy at andyh dot co dot uk
Operating system: n/a
PHP version:      5.0.2
PHP Bug Type:     Documentation problem
Bug description:  imagettftext 'text' parameter wrongly describes Unicode 
character entities

Description:
------------
The description of the 'text' parameter in imagettftext wrongly describes
decimal numeric character entities as "UTF-8 character sequences", whereas
the function actually accepts BOTH of UTF-8 character sequences, and
decimal numeric character entities.

http://uk2.php.net/imagettftext
"
text
    The text string.

    May include any UTF-8 character sequences (of the form: {) to
access characters in a font beyond the first 255
"

{ is not a UTF-8 character sequence, it is a decimal numeric
character reference as per section 5.3.1 of HTML 4.0.1.

http://www.w3.org/TR/html4/charset.html#h-5.3.1

This has nothing to do with the UTF-8 encoding of Unicode characters; the
reference is entirely ASCII, and the character it refers to is the code
point in the Unicode character set - not the corresponding UTF-8 encoding
of that character.

Also the example value "123" given is not past the first 255 characters in
the font.

imagettftext passes the string to GD, which expects a UTF-8 encoded string
according to its documentation. So, any character above 127 will be a
malformed UTF-8 string.

See: http://www.boutell.com/gd/manual2.0.33.html#gdImageStringFT
"
The null-terminated string argument is considered to be encoded via the
UTF_8 standard; also, HTML entities are supported, including decimal,
hexadecimal, and named entities (2.0.26).
"

Given characters in the 128-255 range, which are not valid UTF-8 single
byte characters, it appears to fall back to using them as a single-byte
character, but this is not documented.

Suggest the description be changed to something like:

"
text
    The text string, encoded in UTF-8.

    May include decimal numeric character references (of the form:
€) to access characters in a font beyond position 127.
"

(The value 8364 is the Euro symbol)


-- 
Edit bug report at http://bugs.php.net/?id=30801&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30801&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=30801&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=30801&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30801&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30801&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30801&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30801&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30801&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30801&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30801&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=30801&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=30801&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30801&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30801&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30801&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30801&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30801&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30801&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30801&r=mysqlcfg

Reply via email to