POSIX::strftime() should be able to handle Unicode characters in the format
[p5sagit/p5-mst-13.2.git] / ext / POSIX / POSIX.xs
index 6de3588..b3a64a7 100644 (file)
@@ -1781,7 +1781,7 @@ mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1)
 #     ST(0) = sv_2mortal(newSVpv(...))
 void
 strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
-       char *          fmt
+       SV *            fmt
        int             sec
        int             min
        int             hour
@@ -1793,9 +1793,9 @@ strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
        int             isdst
     CODE:
        {
-           char *buf = my_strftime(fmt, sec, min, hour, mday, mon, year, wday, yday, isdst);
+           char *buf = my_strftime(SvPV_nolen(fmt), sec, min, hour, mday, mon, year, wday, yday, isdst);
            if (buf) {
-               ST(0) = sv_2mortal(newSVpv(buf, 0));
+               ST(0) = newSVpvn_flags(buf, strlen(buf), SVs_TEMP | SvUTF8(fmt));
                Safefree(buf);
            }
        }