Re: snprintf + unicode

From: Date: Mon, 15 Aug 2005 03:15:16 +0000
Subject: Re: snprintf + unicode
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-18083@lists.php.net to get a copy of this message
http://icu.sourceforge.net/apiref/icu4c/ustdio_8h.html#a36 -Andrei On Aug 14, 2005, at 6:34 AM, Derick Rethans wrote:
Hei, currently I've the following [pseudo] code:
    c = "";
    a = snprintf(buffer, 32, "%0d", day);
    b = snprintf(buffer, 32, "%s", daynames[dayofweek]);
    smartstr_appends(&c, a);
    smartstr_appends(&c, b);
    return c.c;
This snippet of code returns a legacy string. Now, as ICU provides the daynames as UTF16 encoded strings, I'm a bit lost as how to solve this. Of course I need to return a UNICODE string now, but which snprintf() like function should I use, so that %0d and friends are printed into the string as UTF16 string which I then can concat together, and return from the function? Derick --Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org


« previous php.internals (#18083) next »