Unicode support for *printf()

php.internals

Antony Dovgal

19 years ago
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

Andrei Zmievski

19 years ago
I know we had discussion about *fprintf() on IRC, but I'm still not clear on some stuff. Sara, could you please explain again why UG(unicode) should not be used as the selection for php_formatted_print/php_u_formatted_print? I bet a few of us are hazy on the streams Unicode/binary details, so let's please clarify this and make sure we're on the same page. Thanks, -Andrei On Dec 11, 2006, at 2:48 PM, Antony Dovgal wrote: