Unicode support for *printf()
| From: | Antony Dovgal | Date: | Mon, 11 Dec 2006 22:48:10 +0000 |
| Subject: | Unicode support for *printf() | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-26903@lists.php.net to get a copy of this message | ||
Hello all.
Attached is the patch which adds Unicode support to *printf() functions stack.
We (Andrei and me) made several assumptions that are worth mentioning:
sprintf() and vsprintf():
- use runtime_encoding when dealing with Unicode data.
printf() and vprintf():
- the result data is converted to output_encoding when formatting is done;
- return _number of bytes_ outputted.
fprintf() and vfprintf():
- use runtime_encoding, as all conversions are done by underlying streams API;
- both functions return the number returned by streams API (which seems to be number of bytes).
I did not run any benchmarks yet, but I don't expect it to cause any major slowdown.
I would like to hear your comments before applying the patch, so don't hesitate to post them.
--
Wbr,
Antony Dovgal