pig: missing setlocale

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pig: missing setlocale

Tobias Stoeckmann-2
Hi,

I was a little bored today so I just played some games. While I was
using pig a little bit, I noticed that german umlauts where not
correctly parsed - a quick glance at pig.c showed up that setlocale()
is missing. With this patch, characters past 7-bit are parsed correctly
(for example "ö" in html style).

--- games/pig/pig.c~ Sun Aug 27 16:30:35 2006
+++ games/pig/pig.c Sun Aug 27 16:34:28 2006
@@ -48,6 +48,7 @@
 
 #include <ctype.h>
 #include <err.h>
+#include <locale.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -62,6 +63,8 @@
  int len;
  int ch;
  char buf[1024];
+
+ setlocale(LC_ALL, "");
 
  while ((ch = getopt(argc, argv, "")) != -1)
  switch(ch) {