mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
4b94c0831e
Back in the far-off twentieth century, it was normal on unix workstations for U+0060 GRAVE ACCENT to be drawn as "‛" and for U+0027 APOSTROPHE to be drawn as "’". This led to the convention of using them as poor-man's ‛smart quotes’ in ASCII-only text. However, "'" is now universally drawn as a vertical line, and "`" at a 45-degree angle, making them an `odd couple' when used together. Unfortunately, there are lots of very old strings in glib, and also lots of new strings in which people have kept up the old tradition, perhaps entirely unaware that it used to not look stupid. Fix this by just using 'dumb quotes' everywhere. https://bugzilla.gnome.org/show_bug.cgi?id=700746
101 lines
1.9 KiB
C
101 lines
1.9 KiB
C
#undef G_DISABLE_ASSERT
|
|
#undef G_LOG_DOMAIN
|
|
|
|
#ifdef GLIB_COMPILATION
|
|
#undef GLIB_COMPILATION
|
|
#endif
|
|
|
|
#include "glib.h"
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <locale.h>
|
|
|
|
/* These only work in the POSIX locale, maybe C too -
|
|
* type POSIX into the program to check them
|
|
*/
|
|
char* posix_tests [] = {
|
|
"19981024",
|
|
"981024",
|
|
"October 1998",
|
|
"October 98",
|
|
"oCT 98",
|
|
"10/24/98",
|
|
"10 -- 24 -- 98",
|
|
"10/24/1998",
|
|
"October 24, 1998",
|
|
NULL
|
|
};
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
GDate* d;
|
|
gchar* loc;
|
|
gchar input[1024];
|
|
|
|
loc = setlocale(LC_ALL,"");
|
|
if (loc)
|
|
g_print("\nLocale set to %s\n", loc);
|
|
else
|
|
g_print("\nLocale unchanged\n");
|
|
|
|
d = g_date_new();
|
|
|
|
while (fgets(input, 1023, stdin))
|
|
{
|
|
if (input[0] == '\n')
|
|
{
|
|
g_print("Enter a date to parse and press enter, or type 'POSIX':\n");
|
|
continue;
|
|
}
|
|
|
|
if (strcmp(input,"POSIX\n") == 0)
|
|
{
|
|
char** s = posix_tests;
|
|
while (*s) {
|
|
g_date_set_parse(d, *s);
|
|
|
|
g_print("POSIXy parse test '%s' ...", *s);
|
|
|
|
if (!g_date_valid(d))
|
|
{
|
|
g_print(" failed.\n");
|
|
}
|
|
else
|
|
{
|
|
gchar buf[256];
|
|
|
|
g_date_strftime(buf,100," parsed '%x' (%B %d %Y)\n",
|
|
d);
|
|
g_print("%s", buf);
|
|
}
|
|
|
|
++s;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
g_date_set_parse(d, input);
|
|
|
|
if (!g_date_valid(d))
|
|
{
|
|
g_print("Parse failed.\n");
|
|
}
|
|
else
|
|
{
|
|
gchar buf[256];
|
|
|
|
g_date_strftime(buf,100,"Parsed: '%x' (%B %d %Y)\n",
|
|
d);
|
|
g_print("%s", buf);
|
|
}
|
|
}
|
|
}
|
|
|
|
g_date_free(d);
|
|
|
|
return 0;
|
|
}
|
|
|
|
|