--- glibc-2.3.3-200405070341/stdio-common/tst-printf.c.orig 2004-06-08 17:38:30.445222640 +0430 +++ glibc-2.3.3-200405070341/stdio-common/tst-printf.c 2004-06-08 17:44:17.259498856 +0430 @@ -28,10 +28,12 @@ #endif #include +#include static void rfg1 (void); static void rfg2 (void); static void rfg3 (void); +static void rfg4 (void); static void @@ -278,6 +280,7 @@ rfg1 (); rfg2 (); rfg3 (); + rfg4 (); { char bytes[7]; @@ -382,3 +385,29 @@ " 12345 1234 11145401322 321.765432 3.217654e+02 5 test-string"); } + +static void +rfg4 (void) +{ + char buf[100]; + char persian_int[100]; + char persian_float[100]; + int i = 12345; + float f = 1234.56; + + setlocale (LC_ALL, "fa_IR.UTF-8"); + + sprintf(persian_int, "%lc%lc%lc%lc%lc%lc", 0x06f1, 0x06f2, 0x066c, 0x06f3, 0x06f4, 0x06f5); + sprintf(persian_float, "%lc%lc%lc%lc%lc%lc%lc%lc", 0x06f1, 0x066c, 0x06f2, 0x06f3, 0x06f4, 0x066b, 0x06f5, 0x06f6); + + sprintf(buf, "%I'd", i); + if (strcmp (buf, persian_int) != 0) + printf ("got: '%s', expected: '%s'\n", buf, persian_int); + + sprintf(buf, "%I'.2f", f); + if (strcmp (buf, persian_float) != 0) + printf ("got: '%s', expected: '%s'\n", buf, persian_float); + + setlocale (LC_ALL, ""); +} +